@fluentui/react-charting 5.24.1 → 5.24.2

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.
Files changed (47) hide show
  1. package/CHANGELOG.json +28 -1
  2. package/CHANGELOG.md +13 -2
  3. package/dist/react-charting.d.ts +5 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +3 -0
  7. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -0
  8. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +104 -38
  9. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  10. package/lib/components/LineChart/LineChart.base.js +23 -17
  11. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  12. package/lib/components/LineChart/LineChart.styles.js +9 -0
  13. package/lib/components/LineChart/LineChart.styles.js.map +1 -1
  14. package/lib/components/LineChart/LineChart.types.d.ts +2 -0
  15. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  16. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +8 -2
  17. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  18. package/lib/types/IDataPoint.d.ts +4 -0
  19. package/lib/types/IDataPoint.js.map +1 -1
  20. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -0
  21. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +106 -39
  22. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  23. package/lib-amd/components/LineChart/LineChart.base.js +23 -17
  24. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  25. package/lib-amd/components/LineChart/LineChart.styles.js +9 -1
  26. package/lib-amd/components/LineChart/LineChart.styles.js.map +1 -1
  27. package/lib-amd/components/LineChart/LineChart.types.d.ts +2 -0
  28. package/lib-amd/components/LineChart/LineChart.types.js.map +1 -1
  29. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +8 -2
  30. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  31. package/lib-amd/types/IDataPoint.d.ts +4 -0
  32. package/lib-amd/types/IDataPoint.js.map +1 -1
  33. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -0
  34. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +106 -39
  35. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  36. package/lib-commonjs/components/LineChart/LineChart.base.js +23 -17
  37. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  38. package/lib-commonjs/components/LineChart/LineChart.styles.js +9 -0
  39. package/lib-commonjs/components/LineChart/LineChart.styles.js.map +1 -1
  40. package/lib-commonjs/components/LineChart/LineChart.types.d.ts +2 -0
  41. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  42. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +8 -2
  43. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  44. package/lib-commonjs/types/IDataPoint.d.ts +4 -0
  45. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  46. package/package.json +1 -1
  47. package/src/components/LineChart/LineChart.types.ts +4 -1
@@ -1015,6 +1015,7 @@ export interface ILineChartDataPoint {
1015
1015
  hideCallout?: boolean;
1016
1016
  markerSize?: number;
1017
1017
  onDataPointClick?: () => void;
1018
+ text?: string;
1018
1019
  x: number | Date;
1019
1020
  xAxisCalloutAccessibilityData?: IAccessibilityProps;
1020
1021
  xAxisCalloutData?: string;
@@ -1082,6 +1083,8 @@ export interface ILineChartStyleProps extends ICartesianChartStyleProps {
1082
1083
 
1083
1084
  // @public
1084
1085
  export interface ILineChartStyles extends ICartesianChartStyles {
1086
+ // (undocumented)
1087
+ markerLabel?: IStyle;
1085
1088
  }
1086
1089
 
1087
1090
  // @public (undocumented)
@@ -15,6 +15,7 @@ import type { ColorwayType } from './PlotlyColorAdapter';
15
15
  export declare const isMonthArray: (data: Datum[] | Datum[][] | TypedArray) => boolean;
16
16
  export declare const correctYearMonth: (xValues: Datum[] | Datum[][] | TypedArray) => any[];
17
17
  export declare const _getGaugeAxisColor: (colorway: string[] | undefined, colorwayType: ColorwayType, color: Color | undefined, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string;
18
+ export declare const resolveXAxisPoint: (x: Datum, isXYearCategory: boolean, isXString: boolean, isXDate: boolean, isXNumber: boolean) => string | Date | number;
18
19
  export declare const transformPlotlyJsonToDonutProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IDonutChartProps;
19
20
  export declare const transformPlotlyJsonToVSBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean, fallbackVSBC?: boolean) => IVerticalStackedBarChartProps;
20
21
  export declare const transformPlotlyJsonToGVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGroupedVerticalBarChartProps;
@@ -150,6 +150,25 @@ export var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMa
150
150
  var extractedColors = extractColor(colorway, colorwayType, color, colorMap, isDarkTheme);
151
151
  return resolveColor(extractedColors, 0, '', colorMap, isDarkTheme);
152
152
  };
153
+ export var resolveXAxisPoint = function (x, isXYearCategory, isXString, isXDate, isXNumber) {
154
+ if (x === null || x === undefined) {
155
+ return '';
156
+ }
157
+ if (isXYearCategory) {
158
+ return x.toString();
159
+ }
160
+ if (isXString) {
161
+ if (isXDate) {
162
+ var date = new Date(x);
163
+ return date;
164
+ }
165
+ if (isXNumber) {
166
+ return parseFloat(x);
167
+ }
168
+ return x;
169
+ }
170
+ return x;
171
+ };
153
172
  export var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, isDarkTheme) {
154
173
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
155
174
  var firstData = input.data[0];
@@ -209,26 +228,45 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayT
209
228
  var yMinValue = 0;
210
229
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
211
230
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
231
+ var colorScale = undefined;
212
232
  input.data.forEach(function (series, index1) {
213
- var _a, _b, _c, _d, _e, _f, _g, _h;
233
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
234
+ if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
235
+ isArrayOrTypedArray((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
236
+ ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
237
+ typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
238
+ colorScale = createColorScale(input.layout, series);
239
+ }
214
240
  var isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
215
241
  // extract bar colors for each series only once
216
- var extractedBarColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
242
+ var extractedBarColors = extractColor((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
217
243
  // extract line colors for each series only once
218
- var extractedLineColors = extractColor((_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, colorwayType, (_h = series.line) === null || _h === void 0 ? void 0 : _h.color, colorMap, isDarkTheme);
244
+ var extractedLineColors = extractColor((_p = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.layout) === null || _p === void 0 ? void 0 : _p.colorway, colorwayType, (_q = series.line) === null || _q === void 0 ? void 0 : _q.color, colorMap, isDarkTheme);
245
+ var xValues = series.x;
246
+ var isXDate = isDateArray(xValues);
247
+ var isXString = isStringArray(xValues);
248
+ var isXNumber = isNumberArray(xValues);
219
249
  var validXYRanges = getValidXYRanges(series);
220
250
  validXYRanges.forEach(function (_a, rangeIdx) {
221
251
  var rangeStart = _a[0], rangeEnd = _a[1];
222
252
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
223
253
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
224
254
  rangeXValues.forEach(function (x, index2) {
225
- var _a, _b;
255
+ var _a, _b, _c, _d, _e, _f;
226
256
  if (!mapXToDataPoints[x]) {
227
- mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };
257
+ mapXToDataPoints[x] = {
258
+ xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
259
+ chartData: [],
260
+ lineData: [],
261
+ };
228
262
  }
229
263
  var legend = legends[index1];
230
- // resolve color for each legend's bars from the extracted colors
231
- var color = resolveColor(extractedBarColors, index1, legend, colorMap, isDarkTheme);
264
+ // resolve color for each legend's bars from the colorscale or extracted colors
265
+ var color = colorScale
266
+ ? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
267
+ ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index2 % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
268
+ : 0)
269
+ : resolveColor(extractedBarColors, index2, legend, colorMap, isDarkTheme);
232
270
  var yVal = rangeYValues[index2];
233
271
  if (series.type === 'bar') {
234
272
  mapXToDataPoints[x].chartData.push({
@@ -243,10 +281,10 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayT
243
281
  else if (series.type === 'scatter' || !!fallbackVSBC) {
244
282
  var lineColor = resolveColor(extractedLineColors, index1, legend, colorMap, isDarkTheme);
245
283
  var lineOptions = getLineOptions(series.line);
246
- var dashType = ((_a = series.line) === null || _a === void 0 ? void 0 : _a.dash) || 'solid';
284
+ var dashType = ((_e = series.line) === null || _e === void 0 ? void 0 : _e.dash) || 'solid';
247
285
  var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot'
248
286
  ? 'dottedLine'
249
- : ((_b = series.mode) === null || _b === void 0 ? void 0 : _b.includes('markers'))
287
+ : ((_f = series.mode) === null || _f === void 0 ? void 0 : _f.includes('markers'))
250
288
  ? 'circle'
251
289
  : 'default';
252
290
  mapXToDataPoints[x].lineData.push({
@@ -268,14 +306,20 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayT
268
306
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
269
307
  return __assign(__assign({ data: Object.values(mapXToDataPoints), width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true });
270
308
  };
271
- var createColorScale = function (colorscale, domain) {
272
- var dMin = domain[0], dMax = domain[1];
309
+ var createColorScale = function (layout, series) {
310
+ var _a, _b, _c, _d, _e, _f;
311
+ var scale = (_a = layout === null || layout === void 0 ? void 0 : layout.coloraxis) === null || _a === void 0 ? void 0 : _a.colorscale;
312
+ var colorValues = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color;
313
+ var _g = [
314
+ (_d = (_c = layout === null || layout === void 0 ? void 0 : layout.coloraxis) === null || _c === void 0 ? void 0 : _c.cmin) !== null && _d !== void 0 ? _d : Math.min.apply(Math, colorValues),
315
+ (_f = (_e = layout === null || layout === void 0 ? void 0 : layout.coloraxis) === null || _e === void 0 ? void 0 : _e.cmax) !== null && _f !== void 0 ? _f : Math.max.apply(Math, colorValues),
316
+ ], dMin = _g[0], dMax = _g[1];
273
317
  // Normalize colorscale domain to actual data domain
274
- var scaleDomain = colorscale.map(function (_a) {
318
+ var scaleDomain = scale.map(function (_a) {
275
319
  var pos = _a[0];
276
320
  return dMin + pos * (dMax - dMin);
277
321
  });
278
- var scaleColors = colorscale.map(function (item) { return item[1]; });
322
+ var scaleColors = scale.map(function (item) { return item[1]; });
279
323
  return d3ScaleLinear().domain(scaleDomain).range(scaleColors);
280
324
  };
281
325
  export var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
@@ -285,23 +329,17 @@ export var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayT
285
329
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
286
330
  var colorScale = undefined;
287
331
  input.data.forEach(function (series, index1) {
288
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
332
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
289
333
  if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
290
334
  isArrayOrTypedArray((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
291
335
  ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
292
336
  typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
293
- var scale = input.layout.coloraxis.colorscale;
294
- var colorValues = (_h = series.marker) === null || _h === void 0 ? void 0 : _h.color;
295
- var _t = [
296
- (_k = (_j = input.layout.coloraxis) === null || _j === void 0 ? void 0 : _j.cmin) !== null && _k !== void 0 ? _k : Math.min.apply(Math, colorValues),
297
- (_m = (_l = input.layout.coloraxis) === null || _l === void 0 ? void 0 : _l.cmax) !== null && _m !== void 0 ? _m : Math.max.apply(Math, colorValues),
298
- ], dMin = _t[0], dMax = _t[1];
299
- colorScale = createColorScale(scale, [dMin, dMax]);
337
+ colorScale = createColorScale(input.layout, series);
300
338
  }
301
339
  // extract colors for each series only once
302
- var extractedColors = extractColor((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.template) === null || _p === void 0 ? void 0 : _p.layout) === null || _q === void 0 ? void 0 : _q.colorway, colorwayType, (_r = series.marker) === null || _r === void 0 ? void 0 : _r.color, colorMap, isDarkTheme);
303
- (_s = series.x) === null || _s === void 0 ? void 0 : _s.forEach(function (x, xIndex) {
304
- var _a, _b, _c, _d;
340
+ var extractedColors = extractColor((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
341
+ (_m = series.x) === null || _m === void 0 ? void 0 : _m.forEach(function (x, xIndex) {
342
+ var _a, _b, _c, _d, _e;
305
343
  if (isInvalidValue(x) || isInvalidValue((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
306
344
  return;
307
345
  }
@@ -312,7 +350,9 @@ export var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayT
312
350
  var legend = legends[index1];
313
351
  // resolve color for each legend's bars from the colorscale or extracted colors
314
352
  var color = colorScale
315
- ? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex] : 0)
353
+ ? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
354
+ ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
355
+ : 0)
316
356
  : resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
317
357
  mapXToDataPoints[x].series.push({
318
358
  key: legend,
@@ -332,13 +372,20 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayTy
332
372
  var _a, _b, _c;
333
373
  var vbcData = [];
334
374
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
375
+ var colorScale = undefined;
335
376
  input.data.forEach(function (series, seriesIdx) {
336
- var _a, _b, _c, _d, _e, _f, _g;
377
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
337
378
  if (!series.x) {
338
379
  return;
339
380
  }
381
+ if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
382
+ isArrayOrTypedArray((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
383
+ ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
384
+ typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
385
+ colorScale = createColorScale(input.layout, series);
386
+ }
340
387
  // extract colors for each series only once
341
- var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
388
+ var extractedColors = extractColor((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
342
389
  var xValues = [];
343
390
  var yValues = [];
344
391
  series.x.forEach(function (xVal, index) {
@@ -352,7 +399,7 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayTy
352
399
  var isXString = isStringArray(xValues);
353
400
  // TODO: In case of a single bin, add an empty bin of the same size to prevent the
354
401
  // default bar width from being used and ensure the bar spans the full intended range.
355
- var xBins = createBins(xValues, (_e = series.xbins) === null || _e === void 0 ? void 0 : _e.start, (_f = series.xbins) === null || _f === void 0 ? void 0 : _f.end, (_g = series.xbins) === null || _g === void 0 ? void 0 : _g.size);
402
+ var xBins = createBins(xValues, (_m = series.xbins) === null || _m === void 0 ? void 0 : _m.start, (_o = series.xbins) === null || _o === void 0 ? void 0 : _o.end, (_p = series.xbins) === null || _p === void 0 ? void 0 : _p.size);
356
403
  var yBins = xBins.map(function () { return []; });
357
404
  var total = 0;
358
405
  xValues.forEach(function (xVal, index) {
@@ -367,9 +414,14 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayTy
367
414
  return yVal;
368
415
  });
369
416
  xBins.forEach(function (bin, index) {
417
+ var _a, _b, _c, _d;
370
418
  var legend = legends[seriesIdx];
371
- // resolve color for each legend's bars from the extracted colors
372
- var color = resolveColor(extractedColors, seriesIdx, legend, colorMap, isDarkTheme);
419
+ // resolve color for each legend's bars from the colorscale or extracted colors
420
+ var color = colorScale
421
+ ? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
422
+ ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
423
+ : 0)
424
+ : resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
373
425
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
374
426
  vbcData.push(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
375
427
  ? {}
@@ -408,9 +460,11 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart
408
460
  // extract colors for each series only once
409
461
  var extractedColors = extractColor((_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, colorwayType, colors, colorMap, isDarkTheme);
410
462
  var xValues = series.x;
411
- var isString = isStringArray(xValues);
463
+ var isXString = isStringArray(xValues);
412
464
  var isXDate = isDateArray(xValues);
413
465
  var isXNumber = isNumberArray(xValues);
466
+ // string case is not possible for scatter chart as it is already filtered out in declarative chart
467
+ var isXYearCategory = false;
414
468
  var legend = legends[index];
415
469
  // resolve color for each legend's lines from the extracted colors
416
470
  var seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
@@ -431,16 +485,17 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart
431
485
  var markerSizes = isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size)
432
486
  ? series.marker.size.slice(rangeStart, rangeEnd)
433
487
  : [];
488
+ var textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : undefined;
434
489
  return {
435
490
  legend: legend,
436
491
  legendShape: legendShape,
437
492
  data: rangeXValues.map(function (x, i) {
438
493
  var _a, _b;
439
- return (__assign({ x: isString ? (isXDate ? new Date(x) : isXNumber ? parseFloat(x) : x) : x, y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
494
+ return (__assign(__assign({ x: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
440
495
  ? { markerSize: markerSizes[i] }
441
496
  : typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
442
497
  ? { markerSize: series.marker.size }
443
- : {})));
498
+ : {})), (textValues ? { text: textValues[i] } : {})));
444
499
  }),
445
500
  color: seriesColor,
446
501
  lineOptions: __assign(__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
@@ -466,20 +521,31 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart
466
521
  export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, colorwayType, isDarkTheme) {
467
522
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
468
523
  var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
524
+ var colorScale = undefined;
469
525
  var chartData = input.data
470
526
  .map(function (series, index) {
471
- var _a, _b, _c, _d;
527
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
528
+ if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
529
+ isArrayOrTypedArray((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
530
+ ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
531
+ typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
532
+ colorScale = createColorScale(input.layout, series);
533
+ }
472
534
  // extract colors for each series only once
473
- var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
535
+ var extractedColors = extractColor((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
474
536
  var legend = legends[index];
475
- // resolve color for each legend's bars from the extracted colors
476
- var color = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
477
537
  return series.y
478
538
  .map(function (yValue, i) {
479
- var _a;
539
+ var _a, _b, _c, _d, _e;
480
540
  if (isInvalidValue((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || isInvalidValue(yValue)) {
481
541
  return null;
482
542
  }
543
+ // resolve color for each legend's bars from the colorscale or extracted colors
544
+ var color = colorScale
545
+ ? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
546
+ ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[i % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
547
+ : 0)
548
+ : resolveColor(extractedColors, i, legend, colorMap, isDarkTheme);
483
549
  return {
484
550
  x: series.x[i],
485
551
  y: yValue,