Skip to content

Commit

Permalink
🔨 use fixed defaultGrapherConfig in migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Nov 11, 2024
1 parent 4b49cf0 commit a6288be
Showing 1 changed file with 76 additions and 3 deletions.
79 changes: 76 additions & 3 deletions db/migration/1720600092980-MakeChartsInheritDefaults.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { MigrationInterface, QueryRunner } from "typeorm"
import { diffGrapherConfigs, mergeGrapherConfigs } from "@ourworldindata/utils"
import { defaultGrapherConfig } from "@ourworldindata/grapher"

export class MakeChartsInheritDefaults1720600092980
implements MigrationInterface
Expand All @@ -27,10 +26,10 @@ export class MakeChartsInheritDefaults1720600092980

const patchConfig = diffGrapherConfigs(
originalConfig,
defaultGrapherConfig
defaultGrapherConfig as any
)
const fullConfig = mergeGrapherConfigs(
defaultGrapherConfig,
defaultGrapherConfig as any,
patchConfig
)

Expand Down Expand Up @@ -62,3 +61,77 @@ export class MakeChartsInheritDefaults1720600092980
)
}
}

const defaultGrapherConfig = {
$schema: "https://files.ourworldindata.org/schemas/grapher-schema.004.json",
map: {
projection: "World",
hideTimeline: false,
colorScale: {
equalSizeBins: true,
binningStrategy: "ckmeans",
customNumericColorsActive: false,
colorSchemeInvert: false,
binningStrategyBinCount: 5,
},
toleranceStrategy: "closest",
tooltipUseCustomLabels: false,
time: "latest",
},
maxTime: "latest",
yAxis: {
removePointsOutsideDomain: false,
scaleType: "linear",
canChangeScaleType: false,
facetDomain: "shared",
},
tab: "chart",
matchingEntitiesOnly: false,
hasChartTab: true,
hideLegend: false,
hideLogo: false,
hideTimeline: false,
colorScale: {
equalSizeBins: true,
binningStrategy: "ckmeans",
customNumericColorsActive: false,
colorSchemeInvert: false,
binningStrategyBinCount: 5,
},
scatterPointLabelStrategy: "year",
selectedFacetStrategy: "none",
invertColorScheme: false,
hideRelativeToggle: true,
logo: "owid",
entityType: "country or region",
facettingLabelByYVariables: "metric",
addCountryMode: "add-country",
compareEndPointsOnly: false,
type: "LineChart",
hasMapTab: false,
stackMode: "absolute",
minTime: "earliest",
hideAnnotationFieldsInTitle: {
entity: false,
time: false,
changeInPrefix: false,
},
xAxis: {
removePointsOutsideDomain: false,
scaleType: "linear",
canChangeScaleType: false,
facetDomain: "shared",
},
hideConnectedScatterLines: false,
showNoDataArea: true,
zoomToSelection: false,
showYearLabels: false,
hideLinesOutsideTolerance: false,
hideTotalValueLabel: false,
hideScatterLabels: false,
sortBy: "total",
sortOrder: "desc",
hideFacetControl: true,
entityTypePlural: "countries and regions",
missingDataStrategy: "auto",
}

0 comments on commit a6288be

Please sign in to comment.