@buildcanada/charts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +8 -0
- package/README.md +113 -0
- package/package.json +137 -0
- package/src/components/BodyPortal/BodyPortal.tsx +40 -0
- package/src/components/Button/Button.scss +110 -0
- package/src/components/Button/Button.tsx +101 -0
- package/src/components/Checkbox.scss +93 -0
- package/src/components/Checkbox.tsx +47 -0
- package/src/components/ExpandableToggle/ExpandableToggle.scss +123 -0
- package/src/components/ExpandableToggle/ExpandableToggle.tsx +60 -0
- package/src/components/GrapherTabIcon.tsx +156 -0
- package/src/components/GrapherTrendArrow.scss +16 -0
- package/src/components/GrapherTrendArrow.tsx +30 -0
- package/src/components/Halo/Halo.tsx +44 -0
- package/src/components/LabeledSwitch/LabeledSwitch.scss +109 -0
- package/src/components/LabeledSwitch/LabeledSwitch.tsx +62 -0
- package/src/components/MarkdownTextWrap/MarkdownTextWrap.tsx +1173 -0
- package/src/components/OverlayHeader.scss +18 -0
- package/src/components/OverlayHeader.tsx +29 -0
- package/src/components/RadioButton.scss +69 -0
- package/src/components/RadioButton.tsx +42 -0
- package/src/components/SimpleMarkdownText.tsx +89 -0
- package/src/components/TextInput.scss +17 -0
- package/src/components/TextInput.tsx +19 -0
- package/src/components/TextWrap/TextWrap.tsx +361 -0
- package/src/components/TextWrap/TextWrapUtils.ts +32 -0
- package/src/components/closeButton/CloseButton.scss +40 -0
- package/src/components/closeButton/CloseButton.tsx +27 -0
- package/src/components/index.ts +70 -0
- package/src/components/loadingIndicator/LoadingIndicator.scss +40 -0
- package/src/components/loadingIndicator/LoadingIndicator.tsx +28 -0
- package/src/components/markdown/remarkPlainLinks.ts +36 -0
- package/src/components/reactUtil.ts +20 -0
- package/src/components/stubs/CodeSnippet.tsx +19 -0
- package/src/components/stubs/DataCitation.tsx +16 -0
- package/src/components/stubs/IndicatorKeyData.tsx +45 -0
- package/src/components/stubs/IndicatorProcessing.tsx +15 -0
- package/src/components/stubs/IndicatorSources.tsx +15 -0
- package/src/components/styles/colors.scss +113 -0
- package/src/components/styles/mixins.scss +630 -0
- package/src/components/styles/typography.scss +579 -0
- package/src/components/styles/util.scss +89 -0
- package/src/components/styles/variables.scss +208 -0
- package/src/config/ChartsConfig.ts +163 -0
- package/src/config/ChartsProvider.tsx +157 -0
- package/src/config/index.ts +20 -0
- package/src/core-table/CoreTable.ts +1355 -0
- package/src/core-table/CoreTableColumns.ts +973 -0
- package/src/core-table/CoreTableUtils.ts +793 -0
- package/src/core-table/ErrorValues.ts +73 -0
- package/src/core-table/OwidTable.ts +1175 -0
- package/src/core-table/OwidTableSynthesizers.ts +272 -0
- package/src/core-table/OwidTableUtil.ts +76 -0
- package/src/core-table/Transforms.ts +484 -0
- package/src/core-table/index.ts +82 -0
- package/src/explorer/ColumnGrammar.ts +217 -0
- package/src/explorer/Explorer.sample.ts +212 -0
- package/src/explorer/Explorer.scss +148 -0
- package/src/explorer/Explorer.tsx +1283 -0
- package/src/explorer/ExplorerConstants.ts +85 -0
- package/src/explorer/ExplorerControls.scss +156 -0
- package/src/explorer/ExplorerControls.tsx +210 -0
- package/src/explorer/ExplorerDecisionMatrix.ts +471 -0
- package/src/explorer/ExplorerGrammar.ts +161 -0
- package/src/explorer/ExplorerProgram.ts +568 -0
- package/src/explorer/ExplorerUtils.ts +59 -0
- package/src/explorer/GrapherGrammar.ts +387 -0
- package/src/explorer/gridLang/GrammarUtils.ts +121 -0
- package/src/explorer/gridLang/GridCell.ts +298 -0
- package/src/explorer/gridLang/GridLangConstants.ts +255 -0
- package/src/explorer/gridLang/GridProgram.ts +311 -0
- package/src/explorer/gridLang/readme.md +17 -0
- package/src/explorer/index.ts +69 -0
- package/src/explorer/readme.md +19 -0
- package/src/explorer/urlMigrations/CO2UrlMigration.ts +46 -0
- package/src/explorer/urlMigrations/CovidUrlMigration.ts +37 -0
- package/src/explorer/urlMigrations/EnergyUrlMigration.ts +41 -0
- package/src/explorer/urlMigrations/ExplorerPageUrlMigrationSpec.ts +12 -0
- package/src/explorer/urlMigrations/ExplorerUrlMigrationUtils.ts +45 -0
- package/src/explorer/urlMigrations/ExplorerUrlMigrations.ts +33 -0
- package/src/explorer/urlMigrations/LegacyCovidUrlMigration.ts +144 -0
- package/src/explorer/urlMigrations/readme.md +39 -0
- package/src/grapher/axis/Axis.ts +973 -0
- package/src/grapher/axis/AxisConfig.ts +179 -0
- package/src/grapher/axis/AxisViews.tsx +597 -0
- package/src/grapher/barCharts/DiscreteBarChart.tsx +728 -0
- package/src/grapher/barCharts/DiscreteBarChartConstants.ts +60 -0
- package/src/grapher/barCharts/DiscreteBarChartHelpers.ts +338 -0
- package/src/grapher/barCharts/DiscreteBarChartState.ts +354 -0
- package/src/grapher/barCharts/DiscreteBarChartThumbnail.tsx +34 -0
- package/src/grapher/captionedChart/CaptionedChart.scss +61 -0
- package/src/grapher/captionedChart/CaptionedChart.tsx +523 -0
- package/src/grapher/captionedChart/Logos.tsx +141 -0
- package/src/grapher/captionedChart/LogosSVG.tsx +16 -0
- package/src/grapher/captionedChart/StaticChartRasterizer.tsx +178 -0
- package/src/grapher/captionedChart/assets/buildcanada-logo-square.svg +15 -0
- package/src/grapher/captionedChart/assets/buildcanada-logo.svg +15 -0
- package/src/grapher/captionedChart/assets/canadaspends.svg +7 -0
- package/src/grapher/captionedChart/readme.md +14 -0
- package/src/grapher/chart/Chart.tsx +62 -0
- package/src/grapher/chart/ChartAreaContent.tsx +172 -0
- package/src/grapher/chart/ChartDimension.ts +121 -0
- package/src/grapher/chart/ChartInterface.ts +83 -0
- package/src/grapher/chart/ChartManager.ts +113 -0
- package/src/grapher/chart/ChartTabs.ts +178 -0
- package/src/grapher/chart/ChartTypeMap.tsx +158 -0
- package/src/grapher/chart/ChartTypeSwitcher.tsx +26 -0
- package/src/grapher/chart/ChartUtils.tsx +364 -0
- package/src/grapher/chart/DimensionSlot.ts +45 -0
- package/src/grapher/chart/StaticChartWrapper.tsx +94 -0
- package/src/grapher/chart/guidedChartUtils.ts +82 -0
- package/src/grapher/color/BinningStrategies.ts +484 -0
- package/src/grapher/color/BinningStrategyEqualSizeBins.ts +132 -0
- package/src/grapher/color/BinningStrategyLogarithmic.ts +121 -0
- package/src/grapher/color/CategoricalColorAssigner.ts +97 -0
- package/src/grapher/color/ColorBrewerSchemes.ts +80 -0
- package/src/grapher/color/ColorConstants.ts +20 -0
- package/src/grapher/color/ColorScale.ts +339 -0
- package/src/grapher/color/ColorScaleBin.ts +147 -0
- package/src/grapher/color/ColorScaleConfig.ts +204 -0
- package/src/grapher/color/ColorScheme.ts +137 -0
- package/src/grapher/color/ColorSchemes.ts +149 -0
- package/src/grapher/color/ColorUtils.ts +86 -0
- package/src/grapher/color/CustomSchemes.ts +1772 -0
- package/src/grapher/color/readme.md +84 -0
- package/src/grapher/comparisonLine/ComparisonLine.tsx +31 -0
- package/src/grapher/comparisonLine/ComparisonLineConstants.ts +11 -0
- package/src/grapher/comparisonLine/ComparisonLineGenerator.ts +60 -0
- package/src/grapher/comparisonLine/ComparisonLineHelpers.ts +10 -0
- package/src/grapher/comparisonLine/CustomComparisonLine.tsx +159 -0
- package/src/grapher/comparisonLine/VerticalComparisonLine.tsx +208 -0
- package/src/grapher/controls/ActionButtons.scss +97 -0
- package/src/grapher/controls/ActionButtons.tsx +453 -0
- package/src/grapher/controls/CommandPalette.scss +50 -0
- package/src/grapher/controls/CommandPalette.tsx +74 -0
- package/src/grapher/controls/ContentSwitchers.scss +93 -0
- package/src/grapher/controls/ContentSwitchers.tsx +238 -0
- package/src/grapher/controls/Controls.scss +158 -0
- package/src/grapher/controls/DataTableFilterDropdown.scss +7 -0
- package/src/grapher/controls/DataTableFilterDropdown.tsx +168 -0
- package/src/grapher/controls/DataTableSearchField.scss +3 -0
- package/src/grapher/controls/DataTableSearchField.tsx +76 -0
- package/src/grapher/controls/Dropdown.scss +252 -0
- package/src/grapher/controls/Dropdown.tsx +235 -0
- package/src/grapher/controls/EntitySelectionToggle.tsx +135 -0
- package/src/grapher/controls/MapRegionDropdown.scss +3 -0
- package/src/grapher/controls/MapRegionDropdown.tsx +104 -0
- package/src/grapher/controls/MapResetButton.tsx +115 -0
- package/src/grapher/controls/MapZoomDropdown.scss +9 -0
- package/src/grapher/controls/MapZoomDropdown.tsx +270 -0
- package/src/grapher/controls/MapZoomToSelectionButton.tsx +87 -0
- package/src/grapher/controls/SearchField.scss +78 -0
- package/src/grapher/controls/SearchField.tsx +63 -0
- package/src/grapher/controls/SettingsMenu.scss +191 -0
- package/src/grapher/controls/SettingsMenu.tsx +399 -0
- package/src/grapher/controls/ShareMenu.scss +58 -0
- package/src/grapher/controls/ShareMenu.tsx +304 -0
- package/src/grapher/controls/SortIcon.tsx +39 -0
- package/src/grapher/controls/VerticalScrollContainer.tsx +263 -0
- package/src/grapher/controls/controlsRow/ControlsRow.tsx +168 -0
- package/src/grapher/controls/dropdown-icons.scss +4 -0
- package/src/grapher/controls/entityPicker/EntityPicker.scss +255 -0
- package/src/grapher/controls/entityPicker/EntityPicker.tsx +816 -0
- package/src/grapher/controls/entityPicker/EntityPickerConstants.ts +23 -0
- package/src/grapher/controls/globalEntitySelector/GlobalEntitySelector.scss +129 -0
- package/src/grapher/controls/globalEntitySelector/GlobalEntitySelector.tsx +463 -0
- package/src/grapher/controls/globalEntitySelector/GlobalEntitySelectorConstants.ts +3 -0
- package/src/grapher/controls/globalEntitySelector/readme.md +17 -0
- package/src/grapher/controls/settings/AbsRelToggle.tsx +64 -0
- package/src/grapher/controls/settings/AxisScaleToggle.tsx +53 -0
- package/src/grapher/controls/settings/FacetStrategySelector.tsx +110 -0
- package/src/grapher/controls/settings/FacetYDomainToggle.tsx +51 -0
- package/src/grapher/controls/settings/NoDataAreaToggle.tsx +38 -0
- package/src/grapher/controls/settings/ZoomToggle.tsx +36 -0
- package/src/grapher/core/EntitiesByRegionType.ts +174 -0
- package/src/grapher/core/EntityCodes.ts +19 -0
- package/src/grapher/core/EntityUrlBuilder.ts +200 -0
- package/src/grapher/core/FetchingGrapher.tsx +156 -0
- package/src/grapher/core/Grapher.tsx +760 -0
- package/src/grapher/core/GrapherAnalytics.ts +229 -0
- package/src/grapher/core/GrapherConstants.ts +173 -0
- package/src/grapher/core/GrapherState.tsx +3659 -0
- package/src/grapher/core/GrapherUrl.ts +184 -0
- package/src/grapher/core/GrapherUrlMigrations.ts +29 -0
- package/src/grapher/core/GrapherUseHelpers.tsx +147 -0
- package/src/grapher/core/LegacyToOwidTable.ts +841 -0
- package/src/grapher/core/grapher.entry.ts +5 -0
- package/src/grapher/core/grapher.scss +257 -0
- package/src/grapher/core/loadGrapherTableHelpers.ts +116 -0
- package/src/grapher/core/loadVariable.ts +104 -0
- package/src/grapher/core/relatedQuestion.ts +12 -0
- package/src/grapher/core/typography.scss +206 -0
- package/src/grapher/dataTable/DataTable.sample.ts +206 -0
- package/src/grapher/dataTable/DataTable.scss +249 -0
- package/src/grapher/dataTable/DataTable.tsx +1332 -0
- package/src/grapher/dataTable/DataTableConstants.ts +186 -0
- package/src/grapher/entitySelector/EntitySelector.scss +255 -0
- package/src/grapher/entitySelector/EntitySelector.tsx +1838 -0
- package/src/grapher/facet/FacetChart.tsx +943 -0
- package/src/grapher/facet/FacetChartConstants.ts +24 -0
- package/src/grapher/facet/FacetChartUtils.ts +51 -0
- package/src/grapher/facet/FacetMap.tsx +604 -0
- package/src/grapher/facet/FacetMapConstants.ts +23 -0
- package/src/grapher/facet/readme.md +13 -0
- package/src/grapher/focus/FocusArray.ts +79 -0
- package/src/grapher/footer/Footer.scss +63 -0
- package/src/grapher/footer/Footer.tsx +809 -0
- package/src/grapher/footer/FooterManager.ts +44 -0
- package/src/grapher/fullScreen/FullScreen.scss +11 -0
- package/src/grapher/fullScreen/FullScreen.tsx +61 -0
- package/src/grapher/header/Header.scss +35 -0
- package/src/grapher/header/Header.tsx +372 -0
- package/src/grapher/header/HeaderManager.ts +28 -0
- package/src/grapher/index.ts +157 -0
- package/src/grapher/interaction/InteractionState.ts +60 -0
- package/src/grapher/legend/HorizontalColorLegends.tsx +923 -0
- package/src/grapher/legend/LegendInteractionState.ts +40 -0
- package/src/grapher/legend/VerticalColorLegend.tsx +295 -0
- package/src/grapher/lineCharts/LineChart.tsx +968 -0
- package/src/grapher/lineCharts/LineChartConstants.ts +89 -0
- package/src/grapher/lineCharts/LineChartHelpers.ts +184 -0
- package/src/grapher/lineCharts/LineChartState.ts +394 -0
- package/src/grapher/lineCharts/LineChartThumbnail.tsx +437 -0
- package/src/grapher/lineCharts/Lines.tsx +258 -0
- package/src/grapher/lineLegend/LineLegend.tsx +723 -0
- package/src/grapher/lineLegend/LineLegendConstants.ts +9 -0
- package/src/grapher/lineLegend/LineLegendFilterAlgorithms.ts +143 -0
- package/src/grapher/lineLegend/LineLegendHelpers.ts +253 -0
- package/src/grapher/lineLegend/LineLegendTypes.ts +32 -0
- package/src/grapher/mapCharts/CanadaTopology.ts +17922 -0
- package/src/grapher/mapCharts/ChoroplethGlobe.tsx +949 -0
- package/src/grapher/mapCharts/ChoroplethMap.tsx +662 -0
- package/src/grapher/mapCharts/GeoFeatures.ts +184 -0
- package/src/grapher/mapCharts/GlobeController.ts +496 -0
- package/src/grapher/mapCharts/MapAnnotationPlacements.json +1040 -0
- package/src/grapher/mapCharts/MapAnnotationPlacements.ts +31 -0
- package/src/grapher/mapCharts/MapAnnotations.ts +723 -0
- package/src/grapher/mapCharts/MapChart.sample.ts +59 -0
- package/src/grapher/mapCharts/MapChart.scss +5 -0
- package/src/grapher/mapCharts/MapChart.tsx +720 -0
- package/src/grapher/mapCharts/MapChartConstants.ts +260 -0
- package/src/grapher/mapCharts/MapChartState.ts +416 -0
- package/src/grapher/mapCharts/MapChartThumbnail.tsx +25 -0
- package/src/grapher/mapCharts/MapComponents.tsx +338 -0
- package/src/grapher/mapCharts/MapConfig.ts +156 -0
- package/src/grapher/mapCharts/MapHelpers.ts +181 -0
- package/src/grapher/mapCharts/MapProjections.ts +49 -0
- package/src/grapher/mapCharts/MapSparkline.tsx +257 -0
- package/src/grapher/mapCharts/MapTooltip.scss +49 -0
- package/src/grapher/mapCharts/MapTooltip.tsx +409 -0
- package/src/grapher/mapCharts/MapTopology.ts +1766 -0
- package/src/grapher/mapCharts/d3-bboxCollide.js +204 -0
- package/src/grapher/mapCharts/d3-geo-projection.ts +198 -0
- package/src/grapher/modal/DownloadIcons.tsx +39 -0
- package/src/grapher/modal/DownloadModal.scss +300 -0
- package/src/grapher/modal/DownloadModal.tsx +1226 -0
- package/src/grapher/modal/EmbedModal.scss +40 -0
- package/src/grapher/modal/EmbedModal.tsx +160 -0
- package/src/grapher/modal/EntitySelectorModal.tsx +59 -0
- package/src/grapher/modal/Modal.scss +31 -0
- package/src/grapher/modal/Modal.tsx +90 -0
- package/src/grapher/modal/ModalHeader.scss +12 -0
- package/src/grapher/modal/ModalHeader.tsx +16 -0
- package/src/grapher/modal/SourcesDescriptions.scss +87 -0
- package/src/grapher/modal/SourcesDescriptions.tsx +89 -0
- package/src/grapher/modal/SourcesKeyDataTable.scss +49 -0
- package/src/grapher/modal/SourcesKeyDataTable.tsx +87 -0
- package/src/grapher/modal/SourcesModal.scss +301 -0
- package/src/grapher/modal/SourcesModal.tsx +568 -0
- package/src/grapher/noDataModal/NoDataModal.tsx +125 -0
- package/src/grapher/scatterCharts/ConnectedScatterLegend.tsx +143 -0
- package/src/grapher/scatterCharts/MultiColorPolyline.tsx +129 -0
- package/src/grapher/scatterCharts/NoDataSection.scss +14 -0
- package/src/grapher/scatterCharts/NoDataSection.tsx +56 -0
- package/src/grapher/scatterCharts/ScatterPlotChart.tsx +792 -0
- package/src/grapher/scatterCharts/ScatterPlotChartConstants.ts +157 -0
- package/src/grapher/scatterCharts/ScatterPlotChartState.ts +678 -0
- package/src/grapher/scatterCharts/ScatterPlotChartThumbnail.tsx +155 -0
- package/src/grapher/scatterCharts/ScatterPlotTooltip.tsx +560 -0
- package/src/grapher/scatterCharts/ScatterPoints.tsx +153 -0
- package/src/grapher/scatterCharts/ScatterPointsWithLabels.tsx +708 -0
- package/src/grapher/scatterCharts/ScatterSizeLegend.tsx +327 -0
- package/src/grapher/scatterCharts/ScatterUtils.ts +265 -0
- package/src/grapher/scatterCharts/Triangle.tsx +41 -0
- package/src/grapher/schema/README.md +33 -0
- package/src/grapher/schema/defaultGrapherConfig.ts +100 -0
- package/src/grapher/schema/grapher-schema.009.yaml +781 -0
- package/src/grapher/schema/migrations/helpers.ts +58 -0
- package/src/grapher/schema/migrations/migrate.ts +75 -0
- package/src/grapher/schema/migrations/migrations.ts +158 -0
- package/src/grapher/selection/MapSelectionArray.ts +99 -0
- package/src/grapher/selection/SelectionArray.ts +71 -0
- package/src/grapher/selection/readme.md +16 -0
- package/src/grapher/sidePanel/SidePanel.scss +10 -0
- package/src/grapher/sidePanel/SidePanel.tsx +23 -0
- package/src/grapher/slideInDrawer/SlideInDrawer.scss +57 -0
- package/src/grapher/slideInDrawer/SlideInDrawer.tsx +125 -0
- package/src/grapher/slideshowController/SlideShowController.tsx +43 -0
- package/src/grapher/slideshowController/readme.md +7 -0
- package/src/grapher/slopeCharts/MarkX.tsx +45 -0
- package/src/grapher/slopeCharts/Slope.tsx +102 -0
- package/src/grapher/slopeCharts/SlopeChart.tsx +1152 -0
- package/src/grapher/slopeCharts/SlopeChartConstants.ts +33 -0
- package/src/grapher/slopeCharts/SlopeChartHelpers.ts +73 -0
- package/src/grapher/slopeCharts/SlopeChartState.ts +392 -0
- package/src/grapher/slopeCharts/SlopeChartThumbnail.tsx +368 -0
- package/src/grapher/stackedCharts/AbstractStackedChartState.ts +370 -0
- package/src/grapher/stackedCharts/MarimekkoBars.tsx +190 -0
- package/src/grapher/stackedCharts/MarimekkoBarsForOneEntity.tsx +168 -0
- package/src/grapher/stackedCharts/MarimekkoChart.tsx +1144 -0
- package/src/grapher/stackedCharts/MarimekkoChartConstants.ts +112 -0
- package/src/grapher/stackedCharts/MarimekkoChartHelpers.ts +21 -0
- package/src/grapher/stackedCharts/MarimekkoChartState.ts +465 -0
- package/src/grapher/stackedCharts/MarimekkoChartThumbnail.tsx +168 -0
- package/src/grapher/stackedCharts/MarimekkoInternalLabels.tsx +124 -0
- package/src/grapher/stackedCharts/StackedAreaChart.tsx +678 -0
- package/src/grapher/stackedCharts/StackedAreaChartState.ts +34 -0
- package/src/grapher/stackedCharts/StackedAreaChartThumbnail.tsx +215 -0
- package/src/grapher/stackedCharts/StackedAreas.tsx +223 -0
- package/src/grapher/stackedCharts/StackedBarChart.tsx +619 -0
- package/src/grapher/stackedCharts/StackedBarChartState.ts +80 -0
- package/src/grapher/stackedCharts/StackedBarChartThumbnail.tsx +220 -0
- package/src/grapher/stackedCharts/StackedBarSegment.tsx +87 -0
- package/src/grapher/stackedCharts/StackedBars.tsx +102 -0
- package/src/grapher/stackedCharts/StackedConstants.ts +109 -0
- package/src/grapher/stackedCharts/StackedDiscreteBarChart.tsx +270 -0
- package/src/grapher/stackedCharts/StackedDiscreteBarChartState.ts +296 -0
- package/src/grapher/stackedCharts/StackedDiscreteBarChartThumbnail.tsx +27 -0
- package/src/grapher/stackedCharts/StackedDiscreteBars.tsx +648 -0
- package/src/grapher/stackedCharts/StackedUtils.ts +142 -0
- package/src/grapher/tabs/Tabs.scss +169 -0
- package/src/grapher/tabs/Tabs.tsx +54 -0
- package/src/grapher/tabs/TabsWithDropdown.scss +62 -0
- package/src/grapher/tabs/TabsWithDropdown.tsx +114 -0
- package/src/grapher/testData/OwidTestData.sample.ts +273 -0
- package/src/grapher/testData/OwidTestData.ts +64 -0
- package/src/grapher/timeline/TimelineComponent.scss +139 -0
- package/src/grapher/timeline/TimelineComponent.tsx +658 -0
- package/src/grapher/timeline/TimelineController.ts +368 -0
- package/src/grapher/timeline/readme.md +7 -0
- package/src/grapher/tooltip/Tooltip.scss +510 -0
- package/src/grapher/tooltip/Tooltip.tsx +294 -0
- package/src/grapher/tooltip/TooltipContents.tsx +383 -0
- package/src/grapher/tooltip/TooltipProps.ts +123 -0
- package/src/grapher/tooltip/TooltipState.ts +81 -0
- package/src/grapher/verticalLabels/VerticalLabels.tsx +31 -0
- package/src/grapher/verticalLabels/VerticalLabelsState.ts +154 -0
- package/src/index.ts +226 -0
- package/src/styles/charts.scss +15 -0
- package/src/types/NominalType.ts +30 -0
- package/src/types/OwidOrigin.ts +18 -0
- package/src/types/OwidSource.ts +9 -0
- package/src/types/OwidVariable.ts +133 -0
- package/src/types/OwidVariableDisplayConfigInterface.ts +49 -0
- package/src/types/analyticsTypes.ts +54 -0
- package/src/types/dbTypes/Tags.ts +11 -0
- package/src/types/domainTypes/Archive.ts +139 -0
- package/src/types/domainTypes/Author.ts +28 -0
- package/src/types/domainTypes/ContentGraph.ts +76 -0
- package/src/types/domainTypes/CoreTableTypes.ts +305 -0
- package/src/types/domainTypes/DeployStatus.ts +23 -0
- package/src/types/domainTypes/Layout.ts +34 -0
- package/src/types/domainTypes/Posts.ts +34 -0
- package/src/types/domainTypes/Search.ts +299 -0
- package/src/types/domainTypes/Site.ts +8 -0
- package/src/types/domainTypes/StaticViz.ts +64 -0
- package/src/types/domainTypes/Toc.ts +11 -0
- package/src/types/domainTypes/Tombstone.ts +19 -0
- package/src/types/domainTypes/Various.ts +79 -0
- package/src/types/gdocTypes/Gdoc.ts +280 -0
- package/src/types/grapherTypes/BinningStrategyTypes.ts +46 -0
- package/src/types/grapherTypes/GrapherConstants.ts +53 -0
- package/src/types/grapherTypes/GrapherTypes.ts +743 -0
- package/src/types/index.ts +316 -0
- package/src/types/wordpressTypes/WordpressTypes.ts +9 -0
- package/src/utils/Bounds.ts +439 -0
- package/src/utils/BrowserUtils.ts +12 -0
- package/src/utils/FuzzySearch.ts +74 -0
- package/src/utils/MultiDimDataPageConfig.ts +31 -0
- package/src/utils/OwidVariable.ts +82 -0
- package/src/utils/PointVector.ts +97 -0
- package/src/utils/PromiseCache.ts +36 -0
- package/src/utils/PromiseSwitcher.ts +52 -0
- package/src/utils/TimeBounds.ts +130 -0
- package/src/utils/Tippy.tsx +57 -0
- package/src/utils/Util.ts +2369 -0
- package/src/utils/archival/archivalDate.ts +48 -0
- package/src/utils/dayjs.ts +32 -0
- package/src/utils/formatValue.ts +242 -0
- package/src/utils/grapherConfigUtils.ts +81 -0
- package/src/utils/image.ts +225 -0
- package/src/utils/index.ts +318 -0
- package/src/utils/isPresent.ts +5 -0
- package/src/utils/metadataHelpers.ts +329 -0
- package/src/utils/persistable/Persistable.ts +82 -0
- package/src/utils/persistable/readme.md +50 -0
- package/src/utils/regions.json +5635 -0
- package/src/utils/regions.ts +463 -0
- package/src/utils/serializers.ts +16 -0
- package/src/utils/string.ts +42 -0
- package/src/utils/urls/Url.ts +195 -0
- package/src/utils/urls/UrlMigration.ts +10 -0
- package/src/utils/urls/UrlUtils.ts +54 -0
- package/src/utils/urls/readme.md +90 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { AvailableTransforms } from "../core-table/index.js"
|
|
2
|
+
import {
|
|
3
|
+
automaticBinningStrategies,
|
|
4
|
+
ColorSchemeName,
|
|
5
|
+
ColumnTypeNames,
|
|
6
|
+
} from "../types/index.js"
|
|
7
|
+
import { ToleranceStrategy } from "../utils/index.js"
|
|
8
|
+
import {
|
|
9
|
+
BooleanCellDef,
|
|
10
|
+
ColumnCellDef,
|
|
11
|
+
EnumCellDef,
|
|
12
|
+
EtlPathCellDef,
|
|
13
|
+
Grammar,
|
|
14
|
+
IntegerCellDef,
|
|
15
|
+
NumericCellDef,
|
|
16
|
+
SlugDeclarationCellDef,
|
|
17
|
+
StringCellDef,
|
|
18
|
+
UrlCellDef,
|
|
19
|
+
} from "./gridLang/GridLangConstants.js"
|
|
20
|
+
|
|
21
|
+
export const ColumnGrammar: Grammar<ColumnCellDef> = {
|
|
22
|
+
variableId: {
|
|
23
|
+
...IntegerCellDef,
|
|
24
|
+
keyword: "variableId",
|
|
25
|
+
description: "Numerical variable ID",
|
|
26
|
+
},
|
|
27
|
+
catalogPath: {
|
|
28
|
+
...EtlPathCellDef,
|
|
29
|
+
keyword: "catalogPath",
|
|
30
|
+
description: "Catalog path to the etl indicator",
|
|
31
|
+
},
|
|
32
|
+
slug: {
|
|
33
|
+
...SlugDeclarationCellDef,
|
|
34
|
+
keyword: "slug",
|
|
35
|
+
},
|
|
36
|
+
name: {
|
|
37
|
+
...StringCellDef,
|
|
38
|
+
keyword: "name",
|
|
39
|
+
description:
|
|
40
|
+
"This is the name that may appear on the y or x axis of a chart",
|
|
41
|
+
},
|
|
42
|
+
type: {
|
|
43
|
+
...StringCellDef,
|
|
44
|
+
keyword: "type",
|
|
45
|
+
description: `The column type reveals how to interpret the data, whether as a string or number for example, and how to display it, like whether to show a % or $.`,
|
|
46
|
+
terminalOptions: Object.values(ColumnTypeNames).map((keyword) => ({
|
|
47
|
+
keyword,
|
|
48
|
+
description: "",
|
|
49
|
+
cssClass: "",
|
|
50
|
+
})),
|
|
51
|
+
},
|
|
52
|
+
transform: {
|
|
53
|
+
...StringCellDef,
|
|
54
|
+
keyword: "transform",
|
|
55
|
+
description: `An advanced option. Available transforms are: ${AvailableTransforms.join(
|
|
56
|
+
", "
|
|
57
|
+
)}`,
|
|
58
|
+
},
|
|
59
|
+
tolerance: {
|
|
60
|
+
...IntegerCellDef,
|
|
61
|
+
keyword: "tolerance",
|
|
62
|
+
description:
|
|
63
|
+
"Set this to interpolate missing values as long as they are within this range of an actual value.",
|
|
64
|
+
},
|
|
65
|
+
toleranceStrategy: {
|
|
66
|
+
...EnumCellDef,
|
|
67
|
+
keyword: "toleranceStrategy",
|
|
68
|
+
terminalOptions: Object.values(ToleranceStrategy).map((strategy) => ({
|
|
69
|
+
keyword: strategy,
|
|
70
|
+
description: "",
|
|
71
|
+
cssClass: "",
|
|
72
|
+
})),
|
|
73
|
+
description: "The tolerance strategy to use",
|
|
74
|
+
},
|
|
75
|
+
description: {
|
|
76
|
+
...StringCellDef,
|
|
77
|
+
keyword: "description",
|
|
78
|
+
description: "Describe the column",
|
|
79
|
+
},
|
|
80
|
+
unit: {
|
|
81
|
+
...StringCellDef,
|
|
82
|
+
keyword: "unit",
|
|
83
|
+
description: "Unit of measurement",
|
|
84
|
+
},
|
|
85
|
+
shortUnit: {
|
|
86
|
+
...StringCellDef,
|
|
87
|
+
keyword: "shortUnit",
|
|
88
|
+
description: "Short (axis) unit",
|
|
89
|
+
},
|
|
90
|
+
notes: {
|
|
91
|
+
...StringCellDef,
|
|
92
|
+
keyword: "notes",
|
|
93
|
+
description: "Any internal notes.",
|
|
94
|
+
},
|
|
95
|
+
annotationsColumnSlug: {
|
|
96
|
+
...StringCellDef,
|
|
97
|
+
keyword: "annotationsColumnSlug",
|
|
98
|
+
description:
|
|
99
|
+
"Column that contains the annotations for this column, if any.",
|
|
100
|
+
},
|
|
101
|
+
sourceName: {
|
|
102
|
+
...StringCellDef,
|
|
103
|
+
keyword: "sourceName",
|
|
104
|
+
description:
|
|
105
|
+
"Source name displayed on charts using this dataset. For academic papers, the name of the source should be 'Authors (year)' e.g. Arroyo-Abad and Lindert (2016). For institutional projects or reports, the name should be 'Institution, Project (year or vintage)' e.g. U.S. Bureau of Labor Statistics, Consumer Expenditure Survey (2015 release). For data that we have modified extensively, the name should be 'Our World in Data based on Author (year)' e.g. Our World in Data based on Atkinson (2002) and Sen (2000).",
|
|
106
|
+
},
|
|
107
|
+
sourceLink: {
|
|
108
|
+
...UrlCellDef,
|
|
109
|
+
keyword: "sourceLink",
|
|
110
|
+
description:
|
|
111
|
+
"Link to the publication from which we retrieved this data",
|
|
112
|
+
},
|
|
113
|
+
dataPublishedBy: {
|
|
114
|
+
...StringCellDef,
|
|
115
|
+
keyword: "dataPublishedBy",
|
|
116
|
+
description:
|
|
117
|
+
"For academic papers this should be a complete reference. For institutional projects, detail the project or report. For data we have modified extensively, list OWID as the publishers and provide the name of the person in charge of the calculation.",
|
|
118
|
+
},
|
|
119
|
+
dataPublisherSource: {
|
|
120
|
+
...StringCellDef,
|
|
121
|
+
keyword: "dataPublisherSource",
|
|
122
|
+
description:
|
|
123
|
+
"Basic indication of how the publisher collected this data e.g. surveys data. Anything longer than a line should go in the dataset description.",
|
|
124
|
+
},
|
|
125
|
+
retrievedDate: {
|
|
126
|
+
...StringCellDef,
|
|
127
|
+
keyword: "retrievedDate",
|
|
128
|
+
description: "Date when this data was obtained by us",
|
|
129
|
+
},
|
|
130
|
+
additionalInfo: {
|
|
131
|
+
...StringCellDef,
|
|
132
|
+
keyword: "additionalInfo",
|
|
133
|
+
description:
|
|
134
|
+
"Describe the dataset and the methodology used in its construction. This can be as long and detailed as you like.",
|
|
135
|
+
},
|
|
136
|
+
nonRedistributable: {
|
|
137
|
+
...BooleanCellDef,
|
|
138
|
+
keyword: "nonRedistributable",
|
|
139
|
+
description: "Disable data download in chart?",
|
|
140
|
+
},
|
|
141
|
+
color: {
|
|
142
|
+
...StringCellDef,
|
|
143
|
+
keyword: "color",
|
|
144
|
+
description: "Default color for column",
|
|
145
|
+
},
|
|
146
|
+
colorScaleScheme: {
|
|
147
|
+
...EnumCellDef,
|
|
148
|
+
keyword: "colorScaleScheme",
|
|
149
|
+
terminalOptions: Object.values(ColorSchemeName).map((keyword) => ({
|
|
150
|
+
keyword,
|
|
151
|
+
description: "",
|
|
152
|
+
cssClass: "",
|
|
153
|
+
})),
|
|
154
|
+
description: "The color scheme to use",
|
|
155
|
+
},
|
|
156
|
+
colorScaleInvert: {
|
|
157
|
+
...BooleanCellDef,
|
|
158
|
+
keyword: "colorScaleInvert",
|
|
159
|
+
description: "Invert the color scale?",
|
|
160
|
+
},
|
|
161
|
+
colorScaleBinningStrategy: {
|
|
162
|
+
...EnumCellDef,
|
|
163
|
+
keyword: "colorScaleBinningStrategy",
|
|
164
|
+
terminalOptions: automaticBinningStrategies.map((keyword) => ({
|
|
165
|
+
keyword,
|
|
166
|
+
description: "",
|
|
167
|
+
cssClass: "",
|
|
168
|
+
})),
|
|
169
|
+
description: "The binning strategy to use",
|
|
170
|
+
},
|
|
171
|
+
colorScaleNoDataLabel: {
|
|
172
|
+
...StringCellDef,
|
|
173
|
+
keyword: "colorScaleNoDataLabel",
|
|
174
|
+
description: "Custom label for the 'No data' bin",
|
|
175
|
+
},
|
|
176
|
+
colorScaleLegendDescription: {
|
|
177
|
+
...StringCellDef,
|
|
178
|
+
keyword: "colorScaleLegendDescription",
|
|
179
|
+
description: "Legend title",
|
|
180
|
+
},
|
|
181
|
+
colorScaleNumericMinValue: {
|
|
182
|
+
...NumericCellDef,
|
|
183
|
+
keyword: "colorScaleNumericMinValue",
|
|
184
|
+
description:
|
|
185
|
+
"Minimum value of the first bin (leaving blank will infer the minimum from the data)",
|
|
186
|
+
},
|
|
187
|
+
colorScaleNumericBins: {
|
|
188
|
+
...StringCellDef,
|
|
189
|
+
keyword: "colorScaleNumericBins",
|
|
190
|
+
description: [
|
|
191
|
+
"Custom numeric bins",
|
|
192
|
+
" Format: [binMax],[color],[label]; [binMax],[color],[label]; ...",
|
|
193
|
+
" Example: 0.1,#ccc,example label; 0.2,,; 0.3,,prev has no label",
|
|
194
|
+
].join("\n"),
|
|
195
|
+
},
|
|
196
|
+
colorScaleCategoricalBins: {
|
|
197
|
+
...StringCellDef,
|
|
198
|
+
keyword: "colorScaleCategoricalBins",
|
|
199
|
+
description: [
|
|
200
|
+
"Custom categorical bins",
|
|
201
|
+
" Format: [data value],[color],[label]; [data value],[color],[label]; ...",
|
|
202
|
+
" Example: one,#ccc,uno; two,,dos",
|
|
203
|
+
].join("\n"),
|
|
204
|
+
},
|
|
205
|
+
isProjection: {
|
|
206
|
+
...BooleanCellDef,
|
|
207
|
+
keyword: "isProjection",
|
|
208
|
+
description: "Is the time series a forward projection?",
|
|
209
|
+
display: true,
|
|
210
|
+
},
|
|
211
|
+
plotMarkersOnlyInLineChart: {
|
|
212
|
+
...BooleanCellDef,
|
|
213
|
+
keyword: "plotMarkersOnlyInLineChart",
|
|
214
|
+
description: "Should data points be connected by a line?",
|
|
215
|
+
display: true,
|
|
216
|
+
},
|
|
217
|
+
} as const
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { DimensionProperty } from "../utils/index.js"
|
|
2
|
+
import { GRAPHER_TAB_CONFIG_OPTIONS } from "../types/index.js"
|
|
3
|
+
import {
|
|
4
|
+
GrapherProgrammaticInterface,
|
|
5
|
+
legacyToOwidTableAndDimensionsWithMandatorySlug,
|
|
6
|
+
} from "../grapher/index.js"
|
|
7
|
+
import { Explorer, ExplorerProps } from "./Explorer.js"
|
|
8
|
+
|
|
9
|
+
const SampleExplorerOfGraphersProgram = `explorerTitle CO₂ Data Explorer
|
|
10
|
+
isPublished false
|
|
11
|
+
explorerSubtitle Download the complete <i>Our World in Data</i> <a href="https://github.com/owid/co2-data">CO₂ and GHG Emissions Dataset</a>.
|
|
12
|
+
subNavId co2
|
|
13
|
+
time earliest..latest
|
|
14
|
+
selection China United States India United Kingdom World
|
|
15
|
+
Gas Radio CO₂
|
|
16
|
+
Accounting Radio Production-based
|
|
17
|
+
subNavCurrentId co2-data-explorer
|
|
18
|
+
graphers
|
|
19
|
+
grapherId Gas Radio Accounting Radio Fuel Dropdown Count Dropdown Relative to world total Checkbox hasMapTab
|
|
20
|
+
488 CO₂ Production-based Total Per country false true
|
|
21
|
+
3219 CO₂ Production-based Total Per country Share of global emissions false
|
|
22
|
+
486 CO₂ Production-based Total Per capita false
|
|
23
|
+
485 CO₂ Production-based Total Cumulative false false
|
|
24
|
+
3218 CO₂ Production-based Total Cumulative Share of global emissions false
|
|
25
|
+
4267 CO₂ Production-based Total Per MWh of energy false
|
|
26
|
+
530 CO₂ Production-based Total Per $ of GDP false
|
|
27
|
+
3621 CO₂ Consumption-based Per country false
|
|
28
|
+
3488 CO₂ Consumption-based Per capita false
|
|
29
|
+
4331 CO₂ Consumption-based Per $ of GDP false
|
|
30
|
+
696 CO₂ Consumption-based Share of emissions embedded in trade false
|
|
31
|
+
4250 CO₂ Production-based Coal Per country false
|
|
32
|
+
4251 CO₂ Production-based Oil Per country false
|
|
33
|
+
4253 CO₂ Production-based Gas Per country false
|
|
34
|
+
4255 CO₂ Production-based Cement Per country false
|
|
35
|
+
4332 CO₂ Production-based Flaring Per country false
|
|
36
|
+
4249 CO₂ Production-based Coal Per capita false
|
|
37
|
+
4252 CO₂ Production-based Oil Per capita false
|
|
38
|
+
4254 CO₂ Production-based Gas Per capita false
|
|
39
|
+
4256 CO₂ Production-based Cement Per capita false
|
|
40
|
+
4333 CO₂ Production-based Flaring Per capita false
|
|
41
|
+
4147 All GHGs (CO₂eq) Production-based Per country false
|
|
42
|
+
4239 All GHGs (CO₂eq) Production-based Per capita false
|
|
43
|
+
4222 Methane Production-based Per country false
|
|
44
|
+
4243 Methane Production-based Per capita false
|
|
45
|
+
4224 Nitrous oxide Production-based Per country false
|
|
46
|
+
4244 Nitrous oxide Production-based Per capita false`
|
|
47
|
+
|
|
48
|
+
// Generate realistic CO2 per capita emissions data (tonnes per person)
|
|
49
|
+
// Based on approximate real-world trends from OWID CO2 data
|
|
50
|
+
function generateCO2PerCapitaData() {
|
|
51
|
+
const startYear = 1990
|
|
52
|
+
const endYear = 2024
|
|
53
|
+
const years: number[] = []
|
|
54
|
+
const entities: number[] = []
|
|
55
|
+
const values: number[] = []
|
|
56
|
+
|
|
57
|
+
// Entity IDs matching the selection: China, United States, India, United Kingdom, World
|
|
58
|
+
const entityData = [
|
|
59
|
+
{
|
|
60
|
+
id: 1,
|
|
61
|
+
name: "China",
|
|
62
|
+
code: "CHN",
|
|
63
|
+
// CO2 per capita rose from ~2 to ~8 tonnes
|
|
64
|
+
baseValue: 2.1,
|
|
65
|
+
trend: (year: number) => 2.1 + (year - 1990) * 0.18,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 2,
|
|
69
|
+
name: "United States",
|
|
70
|
+
code: "USA",
|
|
71
|
+
// CO2 per capita declined from ~20 to ~14 tonnes
|
|
72
|
+
baseValue: 19.5,
|
|
73
|
+
trend: (year: number) =>
|
|
74
|
+
19.5 - (year - 1990) * 0.15 + Math.sin(year * 0.5) * 0.3,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 3,
|
|
78
|
+
name: "India",
|
|
79
|
+
code: "IND",
|
|
80
|
+
// CO2 per capita rose from ~0.7 to ~2 tonnes
|
|
81
|
+
baseValue: 0.7,
|
|
82
|
+
trend: (year: number) => 0.7 + (year - 1990) * 0.04,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 4,
|
|
86
|
+
name: "United Kingdom",
|
|
87
|
+
code: "GBR",
|
|
88
|
+
// CO2 per capita declined from ~10 to ~5 tonnes
|
|
89
|
+
baseValue: 10.2,
|
|
90
|
+
trend: (year: number) =>
|
|
91
|
+
10.2 - (year - 1990) * 0.15 + Math.sin(year * 0.3) * 0.2,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 5,
|
|
95
|
+
name: "World",
|
|
96
|
+
code: "OWID_WRL",
|
|
97
|
+
// Global average rose from ~4 to ~4.7 tonnes
|
|
98
|
+
baseValue: 4.0,
|
|
99
|
+
trend: (year: number) =>
|
|
100
|
+
4.0 + (year - 1990) * 0.02 + Math.sin(year * 0.2) * 0.1,
|
|
101
|
+
},
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
// Generate data for each year and entity
|
|
105
|
+
for (let year = startYear; year <= endYear; year++) {
|
|
106
|
+
for (const entity of entityData) {
|
|
107
|
+
years.push(year)
|
|
108
|
+
entities.push(entity.id)
|
|
109
|
+
// Add some realistic variation
|
|
110
|
+
const baseValue = entity.trend(year)
|
|
111
|
+
const noise = (Math.sin(year * entity.id) * 0.1 + 1) * baseValue
|
|
112
|
+
values.push(Math.round(noise * 100) / 100)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const yearValues: { id: number }[] = []
|
|
117
|
+
for (let year = startYear; year <= endYear; year++) {
|
|
118
|
+
yearValues.push({ id: year })
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
data: { years, entities, values },
|
|
123
|
+
metadata: {
|
|
124
|
+
id: 142609,
|
|
125
|
+
display: { yearIsDay: false },
|
|
126
|
+
dimensions: {
|
|
127
|
+
entities: {
|
|
128
|
+
values: entityData.map((e) => ({
|
|
129
|
+
name: e.name,
|
|
130
|
+
code: e.code,
|
|
131
|
+
id: e.id,
|
|
132
|
+
})),
|
|
133
|
+
},
|
|
134
|
+
years: { values: yearValues },
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const SampleExplorerOfGraphers = (props?: Partial<ExplorerProps>) => {
|
|
141
|
+
const title = "CO₂ emissions per capita"
|
|
142
|
+
const co2Data = generateCO2PerCapitaData()
|
|
143
|
+
const owidDataset = new Map([[142609, co2Data]])
|
|
144
|
+
const dimensions = [
|
|
145
|
+
{
|
|
146
|
+
variableId: 142609,
|
|
147
|
+
property: DimensionProperty.y,
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
const first: GrapherProgrammaticInterface = {
|
|
151
|
+
id: 488,
|
|
152
|
+
title,
|
|
153
|
+
dimensions,
|
|
154
|
+
tab: GRAPHER_TAB_CONFIG_OPTIONS.chart,
|
|
155
|
+
}
|
|
156
|
+
first.table = legacyToOwidTableAndDimensionsWithMandatorySlug(
|
|
157
|
+
owidDataset,
|
|
158
|
+
dimensions,
|
|
159
|
+
{}
|
|
160
|
+
)
|
|
161
|
+
const grapherConfigs: GrapherProgrammaticInterface[] = [
|
|
162
|
+
first,
|
|
163
|
+
{
|
|
164
|
+
...first,
|
|
165
|
+
id: 4147,
|
|
166
|
+
title: "All GHGs per capita",
|
|
167
|
+
},
|
|
168
|
+
]
|
|
169
|
+
return new Explorer({
|
|
170
|
+
slug: "test-slug",
|
|
171
|
+
program: SampleExplorerOfGraphersProgram,
|
|
172
|
+
grapherConfigs,
|
|
173
|
+
adminBaseUrl: "",
|
|
174
|
+
bakedBaseUrl: "",
|
|
175
|
+
bakedGrapherUrl: "",
|
|
176
|
+
dataApiUrl: "",
|
|
177
|
+
...props,
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const SampleInlineDataExplorerProgram = `explorerTitle Sample Explorer
|
|
182
|
+
selection Argentina
|
|
183
|
+
graphers
|
|
184
|
+
Test Radio xSlug ySlugs colorSlug sizeSlug type
|
|
185
|
+
Scatter x y color size ScatterPlot
|
|
186
|
+
Line y LineChart
|
|
187
|
+
|
|
188
|
+
columns
|
|
189
|
+
slug type name
|
|
190
|
+
Country EntityName Country
|
|
191
|
+
Quarter Quarter Quarter
|
|
192
|
+
x Numeric x
|
|
193
|
+
y Numeric y
|
|
194
|
+
color Numeric color
|
|
195
|
+
size Numeric size
|
|
196
|
+
|
|
197
|
+
table
|
|
198
|
+
Country Year x y color size
|
|
199
|
+
Argentina 2020 1 1 1 1
|
|
200
|
+
Argentina 2021 1 1 1 1`
|
|
201
|
+
|
|
202
|
+
export const SampleInlineDataExplorer = (props?: Partial<ExplorerProps>) => {
|
|
203
|
+
return new Explorer({
|
|
204
|
+
slug: "test-slug-inline-data",
|
|
205
|
+
program: SampleInlineDataExplorerProgram,
|
|
206
|
+
adminBaseUrl: "",
|
|
207
|
+
bakedBaseUrl: "",
|
|
208
|
+
bakedGrapherUrl: "",
|
|
209
|
+
dataApiUrl: "",
|
|
210
|
+
...props,
|
|
211
|
+
})
|
|
212
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
$placeholder-height: 800px;
|
|
2
|
+
$chart-border-radius: 2px;
|
|
3
|
+
$explorer-grid-gap: 10px;
|
|
4
|
+
$explorer-min-width-first-col: 200px;
|
|
5
|
+
$explorer-padding: 0.5rem;
|
|
6
|
+
|
|
7
|
+
#ExplorerContainer {
|
|
8
|
+
min-height: $placeholder-height;
|
|
9
|
+
width: 100%;
|
|
10
|
+
position: relative;
|
|
11
|
+
padding: $explorer-padding;
|
|
12
|
+
|
|
13
|
+
.admin-only-locally-edited-checkbox {
|
|
14
|
+
position: absolute;
|
|
15
|
+
right: 5px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
html.IsInIframe #ExplorerContainer {
|
|
20
|
+
height: 100vh;
|
|
21
|
+
min-height: auto !important;
|
|
22
|
+
max-height: none;
|
|
23
|
+
// leave some padding for shadows
|
|
24
|
+
padding: 3px;
|
|
25
|
+
|
|
26
|
+
.admin-only-locally-edited-checkbox {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ExplorerHeaderBox {
|
|
32
|
+
padding: 8px;
|
|
33
|
+
min-width: $explorer-min-width-first-col;
|
|
34
|
+
background: white;
|
|
35
|
+
border-radius: $chart-border-radius;
|
|
36
|
+
box-shadow: $light-shadow;
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
justify-content: space-around;
|
|
40
|
+
|
|
41
|
+
.ExplorerTitle {
|
|
42
|
+
font-size: clamp(16px, 1.5vw, 19px);
|
|
43
|
+
line-height: clamp(18px, 1.7vw, 23px);
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
font-family: $sans-serif-font-stack;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ExplorerSubtitle {
|
|
49
|
+
color: #7a899e;
|
|
50
|
+
font-size: 13px;
|
|
51
|
+
}
|
|
52
|
+
.ExplorerDownloadLink {
|
|
53
|
+
font-size: 13px;
|
|
54
|
+
@include owid-link-60;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.explorerContentContainer {
|
|
59
|
+
// liberale approximation of ExplorerShell._isMobile()
|
|
60
|
+
@media (max-width: 849px) {
|
|
61
|
+
@include wrapper-x-spacing;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media (min-width: 850px) {
|
|
65
|
+
max-width: $max-width-data-explorer;
|
|
66
|
+
margin: 0 auto;
|
|
67
|
+
display: grid;
|
|
68
|
+
grid-template-columns: 1fr 4fr;
|
|
69
|
+
column-gap: $explorer-grid-gap;
|
|
70
|
+
padding: $explorer-padding;
|
|
71
|
+
|
|
72
|
+
.sidebar {
|
|
73
|
+
min-width: $explorer-min-width-first-col;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
html.IsInIframe .Explorer,
|
|
79
|
+
.Explorer.is-embed {
|
|
80
|
+
height: 100%;
|
|
81
|
+
min-height: auto !important;
|
|
82
|
+
max-height: none;
|
|
83
|
+
min-width: auto !important;
|
|
84
|
+
max-width: none;
|
|
85
|
+
padding: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
html.IsInIframe .ExplorerFigure,
|
|
89
|
+
.is-embed .ExplorerFigure {
|
|
90
|
+
min-height: auto !important;
|
|
91
|
+
max-height: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.Explorer {
|
|
95
|
+
margin: 0 auto;
|
|
96
|
+
padding-top: $explorer-grid-gap;
|
|
97
|
+
width: 100%;
|
|
98
|
+
max-width: $max-width-data-explorer;
|
|
99
|
+
height: 90vh;
|
|
100
|
+
max-height: 900px;
|
|
101
|
+
min-height: 480px;
|
|
102
|
+
display: grid;
|
|
103
|
+
grid-template-columns: 1fr 4fr;
|
|
104
|
+
grid-template-rows: 1fr 9fr;
|
|
105
|
+
grid-row-gap: $explorer-grid-gap;
|
|
106
|
+
grid-column-gap: $explorer-grid-gap;
|
|
107
|
+
|
|
108
|
+
&.HideControls {
|
|
109
|
+
display: block;
|
|
110
|
+
|
|
111
|
+
.ExplorerFigure {
|
|
112
|
+
height: 100%;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.mobile-button {
|
|
117
|
+
color: #fff;
|
|
118
|
+
background-color: #3f9eff;
|
|
119
|
+
text-align: center;
|
|
120
|
+
padding: 0.375rem 1rem;
|
|
121
|
+
line-height: 1.5;
|
|
122
|
+
border-radius: 0.25rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.ExplorerFigure {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
position: relative;
|
|
130
|
+
min-height: 600px;
|
|
131
|
+
|
|
132
|
+
// Remove chart from layout calculation.
|
|
133
|
+
// Since grid/flex layouts size to their contents, having the chart dictate that leads to
|
|
134
|
+
// a very slow adaptations to resizing.
|
|
135
|
+
.GrapherComponent {
|
|
136
|
+
position: absolute;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&.mobile-explorer {
|
|
141
|
+
grid-template-columns: auto;
|
|
142
|
+
grid-template-rows: 0fr 0fr 0fr 1fr;
|
|
143
|
+
|
|
144
|
+
.ExplorerFigure {
|
|
145
|
+
min-height: 540px;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|