@classic-homes/charts-react 0.4.1 → 0.5.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/dist/index.cjs CHANGED
@@ -914,11 +914,16 @@ var LineChart = React6.forwardRef(
914
914
  const series = data.series.map((source, index) => ({
915
915
  name: source.name,
916
916
  type: "line",
917
- data: (0, import_charts_core6.withPointLabels)(plotted[index].data, source.labels, formatters.label, {
918
- position: "top"
919
- }),
917
+ data: (0, import_charts_core6.withForecastPoints)(
918
+ (0, import_charts_core6.withPointLabels)(plotted[index].data, source.labels, formatters.label, {
919
+ position: "top"
920
+ }),
921
+ source,
922
+ showDataPoints ? 6 : 0
923
+ ),
920
924
  smooth,
921
- showSymbol,
925
+ // Forecast points show even when the others are hidden (size 0)
926
+ showSymbol: showSymbol || (0, import_charts_core6.forecastStart)(source) !== void 0,
922
927
  symbolSize: showDataPoints ? 6 : 0,
923
928
  connectNulls,
924
929
  stack: stacked ? "Total" : void 0,
@@ -960,7 +965,8 @@ var LineChart = React6.forwardRef(
960
965
  show: showTooltip,
961
966
  formatter: tooltipFormatter,
962
967
  valueFormatter: formatters.tooltip,
963
- getLabel
968
+ getLabel,
969
+ forecastTag: (0, import_charts_core6.forecastTagLookup)(data.series)
964
970
  }
965
971
  ),
966
972
  legend: (0, import_charts_core6.buildLegend)(
@@ -990,12 +996,20 @@ var LineChart = React6.forwardRef(
990
996
  },
991
997
  formatters.axis(yAxisConfig)
992
998
  ),
993
- series: (0, import_charts_core6.withReferenceMarks)(series, referenceLines, referenceBands, {
994
- valueAxis: "y",
995
- format: formatters.format,
996
- color: chartColors.reference,
997
- bandColor: chartColors.referenceBand
998
- })
999
+ series: (0, import_charts_core6.withForecastLines)(
1000
+ (0, import_charts_core6.withReferenceMarks)(series, referenceLines, referenceBands, {
1001
+ valueAxis: "y",
1002
+ format: formatters.format,
1003
+ color: chartColors.reference,
1004
+ bandColor: chartColors.referenceBand
1005
+ }),
1006
+ data.series,
1007
+ {
1008
+ colors: data.series.map(
1009
+ (s, i) => s.color || chartColors.series[i % chartColors.series.length]
1010
+ )
1011
+ }
1012
+ )
999
1013
  },
1000
1014
  optionOverride
1001
1015
  );
@@ -1180,9 +1194,13 @@ var BarChart = React7.forwardRef(
1180
1194
  const series = data.series.map((source, index) => ({
1181
1195
  name: source.name,
1182
1196
  type: "bar",
1183
- data: (0, import_charts_core7.withPointLabels)(plotted[index].data, source.labels, formatters.label, {
1184
- position: labelPosition
1185
- }),
1197
+ data: (0, import_charts_core7.withForecastBars)(
1198
+ (0, import_charts_core7.withPointLabels)(plotted[index].data, source.labels, formatters.label, {
1199
+ position: labelPosition
1200
+ }),
1201
+ source,
1202
+ source.color || chartColors.series[index % chartColors.series.length]
1203
+ ),
1186
1204
  stack: stackIds[index],
1187
1205
  itemStyle: {
1188
1206
  ...source.color && { color: source.color },
@@ -1232,7 +1250,8 @@ var BarChart = React7.forwardRef(
1232
1250
  show: showTooltip,
1233
1251
  formatter: tooltipFormatter,
1234
1252
  valueFormatter: formatters.tooltip,
1235
- getLabel
1253
+ getLabel,
1254
+ forecastTag: (0, import_charts_core7.forecastTagLookup)(data.series)
1236
1255
  }
1237
1256
  ),
1238
1257
  legend: (0, import_charts_core7.buildLegend)(
@@ -1601,9 +1620,12 @@ var AreaChart = React9.forwardRef(
1601
1620
  return {
1602
1621
  name: source.name,
1603
1622
  type: "line",
1604
- data: (0, import_charts_core9.withPointLabels)(plotted[index].data, source.labels, formatters.label, {
1605
- position: "top"
1606
- }),
1623
+ data: (0, import_charts_core9.withForecastPoints)(
1624
+ (0, import_charts_core9.withPointLabels)(plotted[index].data, source.labels, formatters.label, {
1625
+ position: "top"
1626
+ }),
1627
+ source
1628
+ ),
1607
1629
  smooth,
1608
1630
  connectNulls,
1609
1631
  stack: stacked ? "Total" : void 0,
@@ -1623,7 +1645,8 @@ var AreaChart = React9.forwardRef(
1623
1645
  emphasis: {
1624
1646
  focus: "series"
1625
1647
  },
1626
- showSymbol
1648
+ // Forecast points show even when the others are hidden (size 0)
1649
+ ...(0, import_charts_core9.forecastStart)(source) === void 0 ? { showSymbol } : { showSymbol: true, symbolSize: showSymbol ? 4 : 0 }
1627
1650
  };
1628
1651
  });
1629
1652
  return (0, import_charts_core9.mergeChartOption)(
@@ -1653,7 +1676,8 @@ var AreaChart = React9.forwardRef(
1653
1676
  show: showTooltip,
1654
1677
  formatter: tooltipFormatter,
1655
1678
  valueFormatter: formatters.tooltip,
1656
- getLabel
1679
+ getLabel,
1680
+ forecastTag: (0, import_charts_core9.forecastTagLookup)(data.series)
1657
1681
  }
1658
1682
  ),
1659
1683
  legend: (0, import_charts_core9.buildLegend)(
@@ -1680,12 +1704,20 @@ var AreaChart = React9.forwardRef(
1680
1704
  },
1681
1705
  formatters.axis(yAxisConfig)
1682
1706
  ),
1683
- series: (0, import_charts_core9.withReferenceMarks)(series, referenceLines, referenceBands, {
1684
- valueAxis: "y",
1685
- format: formatters.format,
1686
- color: chartColors.reference,
1687
- bandColor: chartColors.referenceBand
1688
- })
1707
+ series: (0, import_charts_core9.withForecastLines)(
1708
+ (0, import_charts_core9.withReferenceMarks)(series, referenceLines, referenceBands, {
1709
+ valueAxis: "y",
1710
+ format: formatters.format,
1711
+ color: chartColors.reference,
1712
+ bandColor: chartColors.referenceBand
1713
+ }),
1714
+ data.series,
1715
+ {
1716
+ colors: data.series.map(
1717
+ (s, i) => s.color || chartColors.series[i % chartColors.series.length]
1718
+ )
1719
+ }
1720
+ )
1689
1721
  },
1690
1722
  optionOverride
1691
1723
  );
package/dist/index.js CHANGED
@@ -440,6 +440,10 @@ import {
440
440
  buildTooltip,
441
441
  categoryTable,
442
442
  chartFormatters,
443
+ forecastStart,
444
+ forecastTagLookup,
445
+ withForecastLines,
446
+ withForecastPoints,
443
447
  generateLineChartDescription,
444
448
  getChartColors,
445
449
  hasPointLabels,
@@ -892,11 +896,16 @@ var LineChart = React6.forwardRef(
892
896
  const series = data.series.map((source, index) => ({
893
897
  name: source.name,
894
898
  type: "line",
895
- data: withPointLabels(plotted[index].data, source.labels, formatters.label, {
896
- position: "top"
897
- }),
899
+ data: withForecastPoints(
900
+ withPointLabels(plotted[index].data, source.labels, formatters.label, {
901
+ position: "top"
902
+ }),
903
+ source,
904
+ showDataPoints ? 6 : 0
905
+ ),
898
906
  smooth,
899
- showSymbol,
907
+ // Forecast points show even when the others are hidden (size 0)
908
+ showSymbol: showSymbol || forecastStart(source) !== void 0,
900
909
  symbolSize: showDataPoints ? 6 : 0,
901
910
  connectNulls,
902
911
  stack: stacked ? "Total" : void 0,
@@ -938,7 +947,8 @@ var LineChart = React6.forwardRef(
938
947
  show: showTooltip,
939
948
  formatter: tooltipFormatter,
940
949
  valueFormatter: formatters.tooltip,
941
- getLabel
950
+ getLabel,
951
+ forecastTag: forecastTagLookup(data.series)
942
952
  }
943
953
  ),
944
954
  legend: buildLegend(
@@ -968,12 +978,20 @@ var LineChart = React6.forwardRef(
968
978
  },
969
979
  formatters.axis(yAxisConfig)
970
980
  ),
971
- series: withReferenceMarks(series, referenceLines, referenceBands, {
972
- valueAxis: "y",
973
- format: formatters.format,
974
- color: chartColors.reference,
975
- bandColor: chartColors.referenceBand
976
- })
981
+ series: withForecastLines(
982
+ withReferenceMarks(series, referenceLines, referenceBands, {
983
+ valueAxis: "y",
984
+ format: formatters.format,
985
+ color: chartColors.reference,
986
+ bandColor: chartColors.referenceBand
987
+ }),
988
+ data.series,
989
+ {
990
+ colors: data.series.map(
991
+ (s, i) => s.color || chartColors.series[i % chartColors.series.length]
992
+ )
993
+ }
994
+ )
977
995
  },
978
996
  optionOverride
979
997
  );
@@ -1070,6 +1088,8 @@ import {
1070
1088
  buildTooltip as buildTooltip2,
1071
1089
  categoryTable as categoryTable2,
1072
1090
  chartFormatters as chartFormatters2,
1091
+ forecastTagLookup as forecastTagLookup2,
1092
+ withForecastBars,
1073
1093
  formatValue,
1074
1094
  generateBarChartDescription,
1075
1095
  getChartColors as getChartColors2,
@@ -1187,9 +1207,13 @@ var BarChart = React7.forwardRef(
1187
1207
  const series = data.series.map((source, index) => ({
1188
1208
  name: source.name,
1189
1209
  type: "bar",
1190
- data: withPointLabels2(plotted[index].data, source.labels, formatters.label, {
1191
- position: labelPosition
1192
- }),
1210
+ data: withForecastBars(
1211
+ withPointLabels2(plotted[index].data, source.labels, formatters.label, {
1212
+ position: labelPosition
1213
+ }),
1214
+ source,
1215
+ source.color || chartColors.series[index % chartColors.series.length]
1216
+ ),
1193
1217
  stack: stackIds[index],
1194
1218
  itemStyle: {
1195
1219
  ...source.color && { color: source.color },
@@ -1239,7 +1263,8 @@ var BarChart = React7.forwardRef(
1239
1263
  show: showTooltip,
1240
1264
  formatter: tooltipFormatter,
1241
1265
  valueFormatter: formatters.tooltip,
1242
- getLabel
1266
+ getLabel,
1267
+ forecastTag: forecastTagLookup2(data.series)
1243
1268
  }
1244
1269
  ),
1245
1270
  legend: buildLegend2(
@@ -1549,6 +1574,10 @@ import {
1549
1574
  buildTooltip as buildTooltip4,
1550
1575
  categoryTable as categoryTable3,
1551
1576
  chartFormatters as chartFormatters3,
1577
+ forecastStart as forecastStart2,
1578
+ forecastTagLookup as forecastTagLookup3,
1579
+ withForecastLines as withForecastLines2,
1580
+ withForecastPoints as withForecastPoints2,
1552
1581
  colorWithAlpha,
1553
1582
  generateAreaChartDescription,
1554
1583
  getChartColors as getChartColors4,
@@ -1648,9 +1677,12 @@ var AreaChart = React9.forwardRef(
1648
1677
  return {
1649
1678
  name: source.name,
1650
1679
  type: "line",
1651
- data: withPointLabels3(plotted[index].data, source.labels, formatters.label, {
1652
- position: "top"
1653
- }),
1680
+ data: withForecastPoints2(
1681
+ withPointLabels3(plotted[index].data, source.labels, formatters.label, {
1682
+ position: "top"
1683
+ }),
1684
+ source
1685
+ ),
1654
1686
  smooth,
1655
1687
  connectNulls,
1656
1688
  stack: stacked ? "Total" : void 0,
@@ -1670,7 +1702,8 @@ var AreaChart = React9.forwardRef(
1670
1702
  emphasis: {
1671
1703
  focus: "series"
1672
1704
  },
1673
- showSymbol
1705
+ // Forecast points show even when the others are hidden (size 0)
1706
+ ...forecastStart2(source) === void 0 ? { showSymbol } : { showSymbol: true, symbolSize: showSymbol ? 4 : 0 }
1674
1707
  };
1675
1708
  });
1676
1709
  return mergeChartOption4(
@@ -1700,7 +1733,8 @@ var AreaChart = React9.forwardRef(
1700
1733
  show: showTooltip,
1701
1734
  formatter: tooltipFormatter,
1702
1735
  valueFormatter: formatters.tooltip,
1703
- getLabel
1736
+ getLabel,
1737
+ forecastTag: forecastTagLookup3(data.series)
1704
1738
  }
1705
1739
  ),
1706
1740
  legend: buildLegend4(
@@ -1727,12 +1761,20 @@ var AreaChart = React9.forwardRef(
1727
1761
  },
1728
1762
  formatters.axis(yAxisConfig)
1729
1763
  ),
1730
- series: withReferenceMarks3(series, referenceLines, referenceBands, {
1731
- valueAxis: "y",
1732
- format: formatters.format,
1733
- color: chartColors.reference,
1734
- bandColor: chartColors.referenceBand
1735
- })
1764
+ series: withForecastLines2(
1765
+ withReferenceMarks3(series, referenceLines, referenceBands, {
1766
+ valueAxis: "y",
1767
+ format: formatters.format,
1768
+ color: chartColors.reference,
1769
+ bandColor: chartColors.referenceBand
1770
+ }),
1771
+ data.series,
1772
+ {
1773
+ colors: data.series.map(
1774
+ (s, i) => s.color || chartColors.series[i % chartColors.series.length]
1775
+ )
1776
+ }
1777
+ )
1736
1778
  },
1737
1779
  optionOverride
1738
1780
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/charts-react",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "React ECharts components for Classic Theme",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",