chartist 1.2.0 → 1.3.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/README.md +1 -0
- package/dist/_settings.scss +1 -1
- package/dist/charts/BarChart/BarChart.d.ts.map +1 -1
- package/dist/charts/BarChart/BarChart.types.d.ts +3 -2
- package/dist/charts/BarChart/BarChart.types.d.ts.map +1 -1
- package/dist/charts/LineChart/LineChart.d.ts.map +1 -1
- package/dist/charts/PieChart/PieChart.d.ts.map +1 -1
- package/dist/charts/PieChart/PieChart.types.d.ts +0 -4
- package/dist/charts/PieChart/PieChart.types.d.ts.map +1 -1
- package/dist/index.cjs +48 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -27
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/utils/functional.d.ts +2 -1
- package/dist/utils/functional.d.ts.map +1 -1
- package/dist/utils/utils.d.ts +4 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -173,6 +173,7 @@ import type {
|
|
|
173
173
|
- [Multi-line labels](http://codesandbox.io/s/github/chartist-js/chartist/main/sandboxes/bar/multiline)
|
|
174
174
|
- [Overlapping bars on mobile](http://codesandbox.io/s/github/chartist-js/chartist/main/sandboxes/bar/overlapping-bars)
|
|
175
175
|
- [Stacked bar chart](http://codesandbox.io/s/github/chartist-js/chartist/main/sandboxes/bar/stacked)
|
|
176
|
+
- [Stacked bar chart with accumulate-relative stack mode](http://codesandbox.io/s/github/chartist-js/chartist/main/sandboxes/bar/stacked-accumulate-relative)
|
|
176
177
|
- [Add peak circles using the draw events](http://codesandbox.io/s/github/chartist-js/chartist/main/sandboxes/bar/with-circle-modify-drawing)
|
|
177
178
|
|
|
178
179
|
</details>
|
package/dist/_settings.scss
CHANGED
|
@@ -34,7 +34,7 @@ $ct-text-color: rgba(0, 0, 0, 0.4) !default;
|
|
|
34
34
|
$ct-text-size: 0.75rem !default;
|
|
35
35
|
$ct-text-align: flex-start !default;
|
|
36
36
|
$ct-text-justify: flex-start !default;
|
|
37
|
-
$ct-text-line-height: 1;
|
|
37
|
+
$ct-text-line-height: 1 !default;
|
|
38
38
|
|
|
39
39
|
// Grid styles
|
|
40
40
|
$ct-grid-color: rgba(0, 0, 0, 0.2) !default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../src/charts/BarChart/BarChart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,2BAA2B,EAG3B,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../src/charts/BarChart/BarChart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,2BAA2B,EAG3B,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAoBpB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAmHzC,qBAAa,QAAS,SAAQ,SAAS,CAAC,mBAAmB,CAAC;cAyCrC,IAAI,EAAE,YAAY;IAxCvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;gBAED,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,EACX,IAAI,EAAE,YAAY,EACrC,OAAO,CAAC,EAAE,eAAe,EACzB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,eAAe,CAAC;IAWxD;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,2BAA2B;CAoZjD"}
|
|
@@ -30,10 +30,11 @@ export interface BarChartOptions<TXAxisOptions = AxisOptions, TYAxisOptions = TX
|
|
|
30
30
|
*/
|
|
31
31
|
stackBars?: boolean;
|
|
32
32
|
/**
|
|
33
|
-
* If set to
|
|
33
|
+
* If set to true this property will force the stacked bars to draw from the zero line.
|
|
34
34
|
* If set to 'accumulate' this property will form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect.
|
|
35
|
+
* If set to 'accumulate-relative' positive and negative values will be handled separately.
|
|
35
36
|
*/
|
|
36
|
-
stackMode?: 'accumulate' | boolean;
|
|
37
|
+
stackMode?: 'accumulate' | 'accumulate-relative' | boolean;
|
|
37
38
|
/**
|
|
38
39
|
* Inverts the axes of the bar chart in order to draw a horizontal bar chart. Be aware that you also need to invert your axis settings as the Y Axis will now display the labels and the X Axis the values.
|
|
39
40
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.types.d.ts","sourceRoot":"","sources":["../../../src/charts/BarChart/BarChart.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,eAAe,EACf,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,oBAAY,YAAY,GAAG,IAAI,CAAC;AAEhC,MAAM,WAAW,eAAe,CAC9B,aAAa,GAAG,WAAW,EAC3B,aAAa,GAAG,aAAa,CAC7B,SAAQ,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC;IAC7C;;OAEG;IACH,UAAU,CAAC,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;Q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1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../src/charts/LineChart/LineChart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,4BAA4B,EAK5B,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAEV,MAAM,EACN,YAAY,EACZ,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,wBAAgB,eAAe,CAC7B,CAAC,SAAS,MAAM,IAAI,CAAC,4BAA4B,EAAE,QAAQ,CAAC,EAE5D,MAAM,EAAE,MAAM,GAAG,YAAY,EAC7B,OAAO,EAAE,4BAA4B,EACrC,GAAG,EAAE,CAAC,mCAeP;AAoGD,qBAAa,SAAU,SAAQ,SAAS,CAAC,oBAAoB,CAAC;cAuFvC,IAAI,EAAE,aAAa;IAtFxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmFG;gBAED,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,EACX,IAAI,EAAE,aAAa,EACtC,OAAO,CAAC,EAAE,gBAAgB,EAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC;IAWzD;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,4BAA4B;
|
|
1
|
+
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../src/charts/LineChart/LineChart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,4BAA4B,EAK5B,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAEV,MAAM,EACN,YAAY,EACZ,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,wBAAgB,eAAe,CAC7B,CAAC,SAAS,MAAM,IAAI,CAAC,4BAA4B,EAAE,QAAQ,CAAC,EAE5D,MAAM,EAAE,MAAM,GAAG,YAAY,EAC7B,OAAO,EAAE,4BAA4B,EACrC,GAAG,EAAE,CAAC,mCAeP;AAoGD,qBAAa,SAAU,SAAQ,SAAS,CAAC,oBAAoB,CAAC;cAuFvC,IAAI,EAAE,aAAa;IAtFxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmFG;gBAED,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,EACX,IAAI,EAAE,aAAa,EACtC,OAAO,CAAC,EAAE,gBAAgB,EAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC;IAWzD;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,4BAA4B;CA8TlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PieChart.d.ts","sourceRoot":"","sources":["../../../src/charts/PieChart/PieChart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,GAAG,EACH,YAAY,EACZ,eAAe,EACf,2BAA2B,EAI3B,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAkBpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"PieChart.d.ts","sourceRoot":"","sources":["../../../src/charts/PieChart/PieChart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,GAAG,EACH,YAAY,EACZ,eAAe,EACf,2BAA2B,EAI3B,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAkBpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA4CzC;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,GAAG,EACV,SAAS,EAAE,cAAc,GACxB,cAAc,CAgBhB;AAED,qBAAa,QAAS,SAAQ,SAAS,CAAC,mBAAmB,CAAC;cA8ErC,IAAI,EAAE,YAAY;IA7EvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0EG;gBAED,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,EACX,IAAI,EAAE,YAAY,EACrC,OAAO,CAAC,EAAE,eAAe,EACzB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,eAAe,CAAC;IAWxD;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,2BAA2B;CA6QjD"}
|
|
@@ -64,10 +64,6 @@ export interface PieChartOptions extends Omit<Options, 'axisX' | 'axisY'> {
|
|
|
64
64
|
* Usually explode is useful when labels are positioned far away from the center.
|
|
65
65
|
*/
|
|
66
66
|
labelDirection?: LabelDirection;
|
|
67
|
-
/**
|
|
68
|
-
* If true the whole data is reversed including labels, the series order as well as the whole series data arrays.
|
|
69
|
-
*/
|
|
70
|
-
reverseData?: boolean;
|
|
71
67
|
/**
|
|
72
68
|
* If true empty values will be ignored to avoid drawing unnecessary slices and labels
|
|
73
69
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PieChart.types.d.ts","sourceRoot":"","sources":["../../../src/charts/PieChart/PieChart.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,SAAS,EACT,qBAAqB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,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O,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,oBAAY,mBAAmB,GAAG,oBAAoB,CACpD,oBAAoB,EACpB,cAAc,GAAG,mBAAmB,CACrC,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -247,12 +247,13 @@ function extend() {
|
|
|
247
247
|
* @return The same value that was provided to the n parameter
|
|
248
248
|
*/ const noop = (n)=>n
|
|
249
249
|
;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
*/ const times = (length)=>Array.from({
|
|
250
|
+
function times(length, filler) {
|
|
251
|
+
return Array.from({
|
|
253
252
|
length
|
|
254
|
-
})
|
|
255
|
-
|
|
253
|
+
}, filler ? (_, i)=>filler(i)
|
|
254
|
+
: ()=>void 0
|
|
255
|
+
);
|
|
256
|
+
}
|
|
256
257
|
/**
|
|
257
258
|
* Sum helper to be used in reduce functions
|
|
258
259
|
*/ const sum = (previous, current)=>previous + (current ? current : 0)
|
|
@@ -271,7 +272,7 @@ function extend() {
|
|
|
271
272
|
* // 2. call arguments: (2, undefined, undefined)
|
|
272
273
|
* ```
|
|
273
274
|
*/ const serialMap = (array, callback)=>times(Math.max(...array.map((element)=>element.length
|
|
274
|
-
))
|
|
275
|
+
)), (index)=>callback(...array.map((element)=>element[index]
|
|
275
276
|
))
|
|
276
277
|
)
|
|
277
278
|
;
|
|
@@ -298,6 +299,14 @@ function getNumberOrUndefined(value) {
|
|
|
298
299
|
}
|
|
299
300
|
return data.every(Array.isArray);
|
|
300
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Loop over array.
|
|
304
|
+
*/ function each(list, callback) {
|
|
305
|
+
let reverse = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
306
|
+
let index = 0;
|
|
307
|
+
list[reverse ? "reduceRight" : "reduce"]((_, item, itemIndex)=>callback(item, index++, itemIndex)
|
|
308
|
+
, void 0);
|
|
309
|
+
}
|
|
301
310
|
|
|
302
311
|
/**
|
|
303
312
|
* Get meta data of a specific value in a series.
|
|
@@ -402,22 +411,25 @@ function normalizeData(data) {
|
|
|
402
411
|
let reverse = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, multi = arguments.length > 2 ? arguments[2] : void 0, distributed = arguments.length > 3 ? arguments[3] : void 0;
|
|
403
412
|
let labelCount;
|
|
404
413
|
const normalized = {
|
|
405
|
-
labels: [],
|
|
414
|
+
labels: (data.labels || []).slice(),
|
|
406
415
|
series: normalizeSeries(data.series, multi, distributed)
|
|
407
416
|
};
|
|
417
|
+
const inputLabelCount = normalized.labels.length;
|
|
408
418
|
// If all elements of the normalized data array are arrays we're dealing with
|
|
409
419
|
// multi series data and we need to find the largest series if they are un-even
|
|
410
420
|
if (isArrayOfArrays(normalized.series)) {
|
|
411
421
|
// Getting the series with the the most elements
|
|
412
|
-
labelCount = Math.max(...normalized.series.map((series)=>series.length
|
|
422
|
+
labelCount = Math.max(inputLabelCount, ...normalized.series.map((series)=>series.length
|
|
413
423
|
));
|
|
424
|
+
normalized.series.forEach((series)=>{
|
|
425
|
+
series.push(...times(Math.max(0, labelCount - series.length)));
|
|
426
|
+
});
|
|
414
427
|
} else {
|
|
415
428
|
// We're dealing with Pie data so we just take the normalized array length
|
|
416
429
|
labelCount = normalized.series.length;
|
|
417
430
|
}
|
|
418
|
-
normalized.labels = (data.labels || []).slice();
|
|
419
431
|
// Padding the labels to labelCount with empty strings
|
|
420
|
-
normalized.labels.push(...times(Math.max(0, labelCount -
|
|
432
|
+
normalized.labels.push(...times(Math.max(0, labelCount - inputLabelCount), ()=>""
|
|
421
433
|
));
|
|
422
434
|
if (reverse) {
|
|
423
435
|
reverseData(normalized);
|
|
@@ -2391,7 +2403,7 @@ class FixedScaleAxis extends Axis {
|
|
|
2391
2403
|
constructor(axisUnit, data, chartRect, options){
|
|
2392
2404
|
const highLow = options.highLow || getHighLow(data, options, axisUnit.pos);
|
|
2393
2405
|
const divisor = options.divisor || 1;
|
|
2394
|
-
const ticks = (options.ticks || times(divisor
|
|
2406
|
+
const ticks = (options.ticks || times(divisor, (index)=>highLow.low + (highLow.high - highLow.low) / divisor * index
|
|
2395
2407
|
)).sort((a, b)=>Number(a) - Number(b)
|
|
2396
2408
|
);
|
|
2397
2409
|
const range = {
|
|
@@ -2565,7 +2577,7 @@ class LineChart extends BaseChart {
|
|
|
2565
2577
|
createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);
|
|
2566
2578
|
}
|
|
2567
2579
|
// Draw the series
|
|
2568
|
-
data.series
|
|
2580
|
+
each(data.series, (series, seriesIndex)=>{
|
|
2569
2581
|
const seriesElement = seriesGroup.elem("g");
|
|
2570
2582
|
const seriesName = safeHasProperty(series, "name") && series.name;
|
|
2571
2583
|
const seriesClassName = safeHasProperty(series, "className") && series.className;
|
|
@@ -2725,7 +2737,7 @@ class LineChart extends BaseChart {
|
|
|
2725
2737
|
});
|
|
2726
2738
|
});
|
|
2727
2739
|
}
|
|
2728
|
-
});
|
|
2740
|
+
}, options.reverseData);
|
|
2729
2741
|
this.eventEmitter.emit("created", {
|
|
2730
2742
|
chartRect,
|
|
2731
2743
|
axisX,
|
|
@@ -2907,8 +2919,9 @@ function getSerialSums(series) {
|
|
|
2907
2919
|
seriesBarDistance: 15,
|
|
2908
2920
|
// If set to true this property will cause the series bars to be stacked. Check the `stackMode` option for further stacking options.
|
|
2909
2921
|
stackBars: false,
|
|
2910
|
-
// If set to
|
|
2922
|
+
// If set to true this property will force the stacked bars to draw from the zero line.
|
|
2911
2923
|
// If set to 'accumulate' this property will form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect.
|
|
2924
|
+
// If set to 'accumulate-relative' positive and negative values will be handled separately.
|
|
2912
2925
|
stackMode: "accumulate",
|
|
2913
2926
|
// Inverts the axes of the bar chart in order to draw a horizontal bar chart. Be aware that you also need to invert your axis settings as the Y Axis will now display the labels and the X Axis the values.
|
|
2914
2927
|
horizontalBars: false,
|
|
@@ -3017,15 +3030,19 @@ class BarChart extends BaseChart {
|
|
|
3017
3030
|
}
|
|
3018
3031
|
// Projected 0 point
|
|
3019
3032
|
const zeroPoint = options.horizontalBars ? chartRect.x1 + valueAxis.projectValue(0) : chartRect.y1 - valueAxis.projectValue(0);
|
|
3033
|
+
const isAccumulateStackMode = options.stackMode === "accumulate";
|
|
3034
|
+
const isAccumulateRelativeStackMode = options.stackMode === "accumulate-relative";
|
|
3020
3035
|
// Used to track the screen coordinates of stacked bars
|
|
3021
|
-
const
|
|
3036
|
+
const posStackedBarValues = [];
|
|
3037
|
+
const negStackedBarValues = [];
|
|
3038
|
+
let stackedBarValues = posStackedBarValues;
|
|
3022
3039
|
labelAxis.createGridAndLabels(gridGroup, labelGroup, options, this.eventEmitter);
|
|
3023
3040
|
valueAxis.createGridAndLabels(gridGroup, labelGroup, options, this.eventEmitter);
|
|
3024
3041
|
if (options.showGridBackground) {
|
|
3025
3042
|
createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);
|
|
3026
3043
|
}
|
|
3027
3044
|
// Draw the series
|
|
3028
|
-
data.series
|
|
3045
|
+
each(data.series, (series, seriesIndex)=>{
|
|
3029
3046
|
// Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.
|
|
3030
3047
|
const biPol = seriesIndex - (data.series.length - 1) / 2;
|
|
3031
3048
|
// Half of the period width between vertical grid lines used to position bars
|
|
@@ -3065,6 +3082,8 @@ class BarChart extends BaseChart {
|
|
|
3065
3082
|
seriesClassName || "".concat(options.classNames.series, "-").concat(alphaNumerate(seriesIndex))
|
|
3066
3083
|
].join(" "));
|
|
3067
3084
|
normalizedData.series[seriesIndex].forEach((value, valueIndex)=>{
|
|
3085
|
+
const valueX = safeHasProperty(value, "x") && value.x;
|
|
3086
|
+
const valueY = safeHasProperty(value, "y") && value.y;
|
|
3068
3087
|
let labelAxisValueIndex;
|
|
3069
3088
|
// We need to set labelAxisValueIndex based on some options combinations
|
|
3070
3089
|
if (options.distributeSeries && !options.stackBars) {
|
|
@@ -3083,13 +3102,13 @@ class BarChart extends BaseChart {
|
|
|
3083
3102
|
// We need to transform coordinates differently based on the chart layout
|
|
3084
3103
|
if (options.horizontalBars) {
|
|
3085
3104
|
projected = {
|
|
3086
|
-
x: chartRect.x1 + valueAxis.projectValue(
|
|
3087
|
-
y: chartRect.y1 - labelAxis.projectValue(
|
|
3105
|
+
x: chartRect.x1 + valueAxis.projectValue(valueX || 0, valueIndex, normalizedData.series[seriesIndex]),
|
|
3106
|
+
y: chartRect.y1 - labelAxis.projectValue(valueY || 0, labelAxisValueIndex, normalizedData.series[seriesIndex])
|
|
3088
3107
|
};
|
|
3089
3108
|
} else {
|
|
3090
3109
|
projected = {
|
|
3091
|
-
x: chartRect.x1 + labelAxis.projectValue(
|
|
3092
|
-
y: chartRect.y1 - valueAxis.projectValue(
|
|
3110
|
+
x: chartRect.x1 + labelAxis.projectValue(valueX || 0, labelAxisValueIndex, normalizedData.series[seriesIndex]),
|
|
3111
|
+
y: chartRect.y1 - valueAxis.projectValue(valueY || 0, valueIndex, normalizedData.series[seriesIndex])
|
|
3093
3112
|
};
|
|
3094
3113
|
}
|
|
3095
3114
|
// If the label axis is a step based axis we will offset the bar into the middle of between two steps using
|
|
@@ -3104,6 +3123,10 @@ class BarChart extends BaseChart {
|
|
|
3104
3123
|
// Using bi-polar offset for multiple series if no stacked bars or series distribution is used
|
|
3105
3124
|
projected[labelAxis.units.pos] += options.stackBars || options.distributeSeries ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);
|
|
3106
3125
|
}
|
|
3126
|
+
// distinguish between positive and negative values in relative stack mode
|
|
3127
|
+
if (isAccumulateRelativeStackMode) {
|
|
3128
|
+
stackedBarValues = valueY >= 0 || valueX >= 0 ? posStackedBarValues : negStackedBarValues;
|
|
3129
|
+
}
|
|
3107
3130
|
// Enter value in stacked bar values used to remember previous screen value for stacking up bars
|
|
3108
3131
|
const previousStack = stackedBarValues[valueIndex] || zeroPoint;
|
|
3109
3132
|
stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);
|
|
@@ -3115,7 +3138,7 @@ class BarChart extends BaseChart {
|
|
|
3115
3138
|
["".concat(labelAxis.units.pos, "1")]: projected[labelAxis.units.pos],
|
|
3116
3139
|
["".concat(labelAxis.units.pos, "2")]: projected[labelAxis.units.pos]
|
|
3117
3140
|
};
|
|
3118
|
-
if (options.stackBars && (
|
|
3141
|
+
if (options.stackBars && (isAccumulateStackMode || isAccumulateRelativeStackMode || !options.stackMode)) {
|
|
3119
3142
|
// Stack mode: accumulate (default)
|
|
3120
3143
|
// If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line
|
|
3121
3144
|
// We want backwards compatibility, so the expected fallback without the 'stackMode' option
|
|
@@ -3137,8 +3160,8 @@ class BarChart extends BaseChart {
|
|
|
3137
3160
|
// Create bar element
|
|
3138
3161
|
const bar = seriesElement.elem("line", positions, options.classNames.bar).attr({
|
|
3139
3162
|
"ct:value": [
|
|
3140
|
-
|
|
3141
|
-
|
|
3163
|
+
valueX,
|
|
3164
|
+
valueY
|
|
3142
3165
|
].filter(isNumeric).join(","),
|
|
3143
3166
|
"ct:meta": serialize(metaData)
|
|
3144
3167
|
});
|
|
@@ -3157,7 +3180,7 @@ class BarChart extends BaseChart {
|
|
|
3157
3180
|
...positions
|
|
3158
3181
|
});
|
|
3159
3182
|
});
|
|
3160
|
-
});
|
|
3183
|
+
}, options.reverseData);
|
|
3161
3184
|
this.eventEmitter.emit("created", {
|
|
3162
3185
|
chartRect,
|
|
3163
3186
|
axisX,
|
|
@@ -3246,8 +3269,6 @@ class BarChart extends BaseChart {
|
|
|
3246
3269
|
labelInterpolationFnc: noop,
|
|
3247
3270
|
// Label direction can be 'neutral', 'explode' or 'implode'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center.
|
|
3248
3271
|
labelDirection: "neutral",
|
|
3249
|
-
// If true the whole data is reversed including labels, the series order as well as the whole series data arrays.
|
|
3250
|
-
reverseData: false,
|
|
3251
3272
|
// If true empty values will be ignored to avoid drawing unnecessary slices and labels
|
|
3252
3273
|
ignoreEmptyValues: false
|
|
3253
3274
|
};
|
|
@@ -3548,6 +3569,7 @@ exports.createLabel = createLabel;
|
|
|
3548
3569
|
exports.createSvg = createSvg;
|
|
3549
3570
|
exports.deserialize = deserialize;
|
|
3550
3571
|
exports.determineAnchorPosition = determineAnchorPosition;
|
|
3572
|
+
exports.each = each;
|
|
3551
3573
|
exports.easings = easings;
|
|
3552
3574
|
exports.ensureUnit = ensureUnit;
|
|
3553
3575
|
exports.escapingMap = escapingMap;
|