pace-chart-lib 1.0.35 → 1.0.36
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/pace-chart-lib.es.js +31 -13
- package/dist/pace-chart-lib.umd.js +31 -13
- package/package.json +1 -1
|
@@ -12752,9 +12752,11 @@ const MONTH_NAMES = {
|
|
|
12752
12752
|
]
|
|
12753
12753
|
};
|
|
12754
12754
|
const getDateFromDimension = (dimension) => {
|
|
12755
|
-
const
|
|
12756
|
-
|
|
12757
|
-
const
|
|
12755
|
+
const serial = Number(dimension);
|
|
12756
|
+
if (!Number.isFinite(serial)) return null;
|
|
12757
|
+
const utcDays = Math.floor(serial - 25569);
|
|
12758
|
+
const date2 = new Date(utcDays * 86400 * 1e3);
|
|
12759
|
+
if (Number.isNaN(date2.getTime())) return null;
|
|
12758
12760
|
return {
|
|
12759
12761
|
day: date2.getUTCDate(),
|
|
12760
12762
|
month: date2.getUTCMonth(),
|
|
@@ -12813,8 +12815,9 @@ const formatDate = (day, month, year, format2) => {
|
|
|
12813
12815
|
const setDateFormats = (format2, dimensionmarks) => {
|
|
12814
12816
|
try {
|
|
12815
12817
|
return dimensionmarks.map((dim) => {
|
|
12816
|
-
const
|
|
12817
|
-
if (
|
|
12818
|
+
const date2 = getDateFromDimension(dim);
|
|
12819
|
+
if (!date2) return dim;
|
|
12820
|
+
const { day, month, year } = date2;
|
|
12818
12821
|
return formatDate(day, month, year, format2);
|
|
12819
12822
|
});
|
|
12820
12823
|
} catch (error) {
|
|
@@ -13222,7 +13225,9 @@ function commonAnnotations(chartData, xScale, yScaleLeft, yScaleRight, margin, d
|
|
|
13222
13225
|
responsiveXaxisLabel(dimensionList, innerWidth2).includes(d.Dimension) && !labelExcludeList.includes(d.Legend) && (d.Axis == axisTypes.primary ? yScaleLeft(d.Measure) <= innerHeight2 && yScaleLeft(d.Measure) >= 0 : yScaleRight(d.Measure) <= innerHeight2 && yScaleRight(d.Measure) >= 0) ? annotationsList.push(singleAnnotation) : null;
|
|
13223
13226
|
}
|
|
13224
13227
|
});
|
|
13225
|
-
|
|
13228
|
+
if (formatOptions.annotation.annotationHideZeroValues) {
|
|
13229
|
+
annotationsList = annotationsList.filter((d) => d.data.y.measure != 0);
|
|
13230
|
+
}
|
|
13226
13231
|
if (oldAnnotationList.length === 0) {
|
|
13227
13232
|
oldAnnotationList = annotationsList;
|
|
13228
13233
|
oldMap = new Map(
|
|
@@ -15046,7 +15051,7 @@ function stacklineAnnotations(chartData, xScale, yScaleLeft, yScaleRight, margin
|
|
|
15046
15051
|
break;
|
|
15047
15052
|
case "6":
|
|
15048
15053
|
chartData.forEach((d) => {
|
|
15049
|
-
let annotationVisibility = d[0]
|
|
15054
|
+
let annotationVisibility = d[0]?.properties?.annotation?.toString();
|
|
15050
15055
|
switch (annotationVisibility) {
|
|
15051
15056
|
case "1":
|
|
15052
15057
|
for (let i = 0; i < chartData[0].length; i++) {
|
|
@@ -15260,15 +15265,24 @@ const appendAnnotations = (svg, formatOptions, margin, fontStyle, makeAnnotation
|
|
|
15260
15265
|
const transform = select$2(this).attr("transform");
|
|
15261
15266
|
const translateValues = transform.match(/translate\(([^,]+),([^,]+)\)/);
|
|
15262
15267
|
if (translateValues) {
|
|
15263
|
-
const currentX = parseFloat(translateValues[1]);
|
|
15268
|
+
const currentX = isBarChart ? 0 : parseFloat(translateValues[1]);
|
|
15264
15269
|
return `translate(${currentX}, 0)`;
|
|
15265
15270
|
}
|
|
15266
15271
|
});
|
|
15267
15272
|
annotations.selectAll("text").style(
|
|
15268
15273
|
"text-anchor",
|
|
15269
15274
|
(d) => isBarChart ? d.data.position == "2" ? "middle" : "start" : "start"
|
|
15270
|
-
).append("text").style(
|
|
15271
|
-
|
|
15275
|
+
).append("text").style(
|
|
15276
|
+
"fill",
|
|
15277
|
+
formatOptions.annotation.annotationColor !== commonColors.white ? formatOptions.annotation.annotationColor : "none"
|
|
15278
|
+
);
|
|
15279
|
+
annotations.selectAll("tspan").attr(
|
|
15280
|
+
"hoverId",
|
|
15281
|
+
(d) => d.data.hoverId ? d.data.hoverId : d.data.currentLegend.replaceAll(" ", "-")
|
|
15282
|
+
).style(
|
|
15283
|
+
"visibility",
|
|
15284
|
+
(d) => parseFloat(d.data.y) == 0 && formatOptions.annotation.annotationHideZeroValues ? "hidden" : "visible"
|
|
15285
|
+
);
|
|
15272
15286
|
return annotations;
|
|
15273
15287
|
};
|
|
15274
15288
|
const initXaxisBar = (formatOptions, gTag, yLabel, innerHeight2, innerWidth2, xAxisBottom) => {
|
|
@@ -18363,7 +18377,7 @@ const CustomColumnChart = ({
|
|
|
18363
18377
|
(d) => `translate(${xScale(d.data.dimension) - columnWidth / 2},0)`
|
|
18364
18378
|
).merge(rects).attr(
|
|
18365
18379
|
"hoverId",
|
|
18366
|
-
(d) => d.
|
|
18380
|
+
(d) => d.alias.includes("~$~") ? d.alias.split("~$~")[1].replace(/ /g, "-") : d.alias.replace(/ /g, "-")
|
|
18367
18381
|
).attr("x", (d) => xScaleForLegends(chartTypes.StackColumnChart)).attr(
|
|
18368
18382
|
"y",
|
|
18369
18383
|
(d) => d.data.axis === axisTypes.primary ? yScaleLeft(d[1]) : yScaleRight(d[1])
|
|
@@ -18550,6 +18564,7 @@ const CustomColumnChart = ({
|
|
|
18550
18564
|
stackChartData.forEach((stackData, j) => {
|
|
18551
18565
|
stackData.forEach((d) => {
|
|
18552
18566
|
d["key"] = stackData.key;
|
|
18567
|
+
d["alias"] = requiredStackChatData.data[j].properties.alias;
|
|
18553
18568
|
stackData["alias"] = requiredStackChatData.data[j].properties.alias;
|
|
18554
18569
|
stackData["color"] = JSON.parse(
|
|
18555
18570
|
JSON.stringify(requiredStackChatData.data[j].properties.color)
|
|
@@ -21656,7 +21671,7 @@ const LineChart = ({
|
|
|
21656
21671
|
chartJSON.chartData = allChartData;
|
|
21657
21672
|
chartJSON.legendList = legendList;
|
|
21658
21673
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
21659
|
-
chartJSON.yMinLeft = yMinLeft
|
|
21674
|
+
chartJSON.yMinLeft = yMinLeft;
|
|
21660
21675
|
chartJSON.yMaxRight = yMaxRight;
|
|
21661
21676
|
chartJSON.yMinRight = yMinRight;
|
|
21662
21677
|
formatedDimensionList = isDateType ? setDateFormats(
|
|
@@ -21690,7 +21705,7 @@ const LineChart = ({
|
|
|
21690
21705
|
chartJSON.yMinLeft = yAxisLabelArray[0];
|
|
21691
21706
|
{
|
|
21692
21707
|
yScaleLeft = linear$1().domain([
|
|
21693
|
-
chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : 0 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
|
|
21708
|
+
chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : chartJSON.yMinLeft * 0.9 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
|
|
21694
21709
|
chartJSON.yMaxLeft <= 0 ? 0 : customYaxisMaxValue !== void 0 && !Number.isNaN(customYaxisMaxValue) ? customYaxisMaxValue : chartJSON.yMaxLeft * 1.1
|
|
21695
21710
|
]).range([
|
|
21696
21711
|
dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2,
|
|
@@ -22500,6 +22515,7 @@ const StackLineChart = ({
|
|
|
22500
22515
|
d["hideZero"] = JSON.parse(
|
|
22501
22516
|
JSON.stringify(seriesData[j].properties.hideZeroValues)
|
|
22502
22517
|
);
|
|
22518
|
+
d["properties"] = seriesData[j].properties;
|
|
22503
22519
|
})
|
|
22504
22520
|
);
|
|
22505
22521
|
};
|
|
@@ -23022,6 +23038,7 @@ const NormalisedStackLineChart = ({
|
|
|
23022
23038
|
d["hideZero"] = JSON.parse(
|
|
23023
23039
|
JSON.stringify(seriesData[j].properties.hideZeroValues)
|
|
23024
23040
|
);
|
|
23041
|
+
d["properties"] = seriesData[j].properties;
|
|
23025
23042
|
})
|
|
23026
23043
|
);
|
|
23027
23044
|
};
|
|
@@ -27587,6 +27604,7 @@ const NormalizedStackAreaChart = ({
|
|
|
27587
27604
|
d["hideZero"] = JSON.parse(
|
|
27588
27605
|
JSON.stringify(seriesData[j].properties.hideZeroValues)
|
|
27589
27606
|
);
|
|
27607
|
+
d["properties"] = seriesData[j].properties;
|
|
27590
27608
|
})
|
|
27591
27609
|
);
|
|
27592
27610
|
};
|
|
@@ -12755,9 +12755,11 @@
|
|
|
12755
12755
|
]
|
|
12756
12756
|
};
|
|
12757
12757
|
const getDateFromDimension = (dimension) => {
|
|
12758
|
-
const
|
|
12759
|
-
|
|
12760
|
-
const
|
|
12758
|
+
const serial = Number(dimension);
|
|
12759
|
+
if (!Number.isFinite(serial)) return null;
|
|
12760
|
+
const utcDays = Math.floor(serial - 25569);
|
|
12761
|
+
const date2 = new Date(utcDays * 86400 * 1e3);
|
|
12762
|
+
if (Number.isNaN(date2.getTime())) return null;
|
|
12761
12763
|
return {
|
|
12762
12764
|
day: date2.getUTCDate(),
|
|
12763
12765
|
month: date2.getUTCMonth(),
|
|
@@ -12816,8 +12818,9 @@
|
|
|
12816
12818
|
const setDateFormats = (format2, dimensionmarks) => {
|
|
12817
12819
|
try {
|
|
12818
12820
|
return dimensionmarks.map((dim) => {
|
|
12819
|
-
const
|
|
12820
|
-
if (
|
|
12821
|
+
const date2 = getDateFromDimension(dim);
|
|
12822
|
+
if (!date2) return dim;
|
|
12823
|
+
const { day, month, year } = date2;
|
|
12821
12824
|
return formatDate(day, month, year, format2);
|
|
12822
12825
|
});
|
|
12823
12826
|
} catch (error) {
|
|
@@ -13225,7 +13228,9 @@
|
|
|
13225
13228
|
responsiveXaxisLabel(dimensionList, innerWidth2).includes(d.Dimension) && !labelExcludeList.includes(d.Legend) && (d.Axis == axisTypes.primary ? yScaleLeft(d.Measure) <= innerHeight2 && yScaleLeft(d.Measure) >= 0 : yScaleRight(d.Measure) <= innerHeight2 && yScaleRight(d.Measure) >= 0) ? annotationsList.push(singleAnnotation) : null;
|
|
13226
13229
|
}
|
|
13227
13230
|
});
|
|
13228
|
-
|
|
13231
|
+
if (formatOptions.annotation.annotationHideZeroValues) {
|
|
13232
|
+
annotationsList = annotationsList.filter((d) => d.data.y.measure != 0);
|
|
13233
|
+
}
|
|
13229
13234
|
if (oldAnnotationList.length === 0) {
|
|
13230
13235
|
oldAnnotationList = annotationsList;
|
|
13231
13236
|
oldMap = new Map(
|
|
@@ -15049,7 +15054,7 @@
|
|
|
15049
15054
|
break;
|
|
15050
15055
|
case "6":
|
|
15051
15056
|
chartData.forEach((d) => {
|
|
15052
|
-
let annotationVisibility = d[0]
|
|
15057
|
+
let annotationVisibility = d[0]?.properties?.annotation?.toString();
|
|
15053
15058
|
switch (annotationVisibility) {
|
|
15054
15059
|
case "1":
|
|
15055
15060
|
for (let i = 0; i < chartData[0].length; i++) {
|
|
@@ -15263,15 +15268,24 @@
|
|
|
15263
15268
|
const transform = select$2(this).attr("transform");
|
|
15264
15269
|
const translateValues = transform.match(/translate\(([^,]+),([^,]+)\)/);
|
|
15265
15270
|
if (translateValues) {
|
|
15266
|
-
const currentX = parseFloat(translateValues[1]);
|
|
15271
|
+
const currentX = isBarChart ? 0 : parseFloat(translateValues[1]);
|
|
15267
15272
|
return `translate(${currentX}, 0)`;
|
|
15268
15273
|
}
|
|
15269
15274
|
});
|
|
15270
15275
|
annotations.selectAll("text").style(
|
|
15271
15276
|
"text-anchor",
|
|
15272
15277
|
(d) => isBarChart ? d.data.position == "2" ? "middle" : "start" : "start"
|
|
15273
|
-
).append("text").style(
|
|
15274
|
-
|
|
15278
|
+
).append("text").style(
|
|
15279
|
+
"fill",
|
|
15280
|
+
formatOptions.annotation.annotationColor !== commonColors.white ? formatOptions.annotation.annotationColor : "none"
|
|
15281
|
+
);
|
|
15282
|
+
annotations.selectAll("tspan").attr(
|
|
15283
|
+
"hoverId",
|
|
15284
|
+
(d) => d.data.hoverId ? d.data.hoverId : d.data.currentLegend.replaceAll(" ", "-")
|
|
15285
|
+
).style(
|
|
15286
|
+
"visibility",
|
|
15287
|
+
(d) => parseFloat(d.data.y) == 0 && formatOptions.annotation.annotationHideZeroValues ? "hidden" : "visible"
|
|
15288
|
+
);
|
|
15275
15289
|
return annotations;
|
|
15276
15290
|
};
|
|
15277
15291
|
const initXaxisBar = (formatOptions, gTag, yLabel, innerHeight2, innerWidth2, xAxisBottom) => {
|
|
@@ -18366,7 +18380,7 @@
|
|
|
18366
18380
|
(d) => `translate(${xScale(d.data.dimension) - columnWidth / 2},0)`
|
|
18367
18381
|
).merge(rects).attr(
|
|
18368
18382
|
"hoverId",
|
|
18369
|
-
(d) => d.
|
|
18383
|
+
(d) => d.alias.includes("~$~") ? d.alias.split("~$~")[1].replace(/ /g, "-") : d.alias.replace(/ /g, "-")
|
|
18370
18384
|
).attr("x", (d) => xScaleForLegends(chartTypes.StackColumnChart)).attr(
|
|
18371
18385
|
"y",
|
|
18372
18386
|
(d) => d.data.axis === axisTypes.primary ? yScaleLeft(d[1]) : yScaleRight(d[1])
|
|
@@ -18553,6 +18567,7 @@
|
|
|
18553
18567
|
stackChartData.forEach((stackData, j) => {
|
|
18554
18568
|
stackData.forEach((d) => {
|
|
18555
18569
|
d["key"] = stackData.key;
|
|
18570
|
+
d["alias"] = requiredStackChatData.data[j].properties.alias;
|
|
18556
18571
|
stackData["alias"] = requiredStackChatData.data[j].properties.alias;
|
|
18557
18572
|
stackData["color"] = JSON.parse(
|
|
18558
18573
|
JSON.stringify(requiredStackChatData.data[j].properties.color)
|
|
@@ -21659,7 +21674,7 @@
|
|
|
21659
21674
|
chartJSON.chartData = allChartData;
|
|
21660
21675
|
chartJSON.legendList = legendList;
|
|
21661
21676
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
21662
|
-
chartJSON.yMinLeft = yMinLeft
|
|
21677
|
+
chartJSON.yMinLeft = yMinLeft;
|
|
21663
21678
|
chartJSON.yMaxRight = yMaxRight;
|
|
21664
21679
|
chartJSON.yMinRight = yMinRight;
|
|
21665
21680
|
formatedDimensionList = isDateType ? setDateFormats(
|
|
@@ -21693,7 +21708,7 @@
|
|
|
21693
21708
|
chartJSON.yMinLeft = yAxisLabelArray[0];
|
|
21694
21709
|
{
|
|
21695
21710
|
yScaleLeft = linear$1().domain([
|
|
21696
|
-
chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : 0 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
|
|
21711
|
+
chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : chartJSON.yMinLeft * 0.9 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
|
|
21697
21712
|
chartJSON.yMaxLeft <= 0 ? 0 : customYaxisMaxValue !== void 0 && !Number.isNaN(customYaxisMaxValue) ? customYaxisMaxValue : chartJSON.yMaxLeft * 1.1
|
|
21698
21713
|
]).range([
|
|
21699
21714
|
dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2,
|
|
@@ -22503,6 +22518,7 @@
|
|
|
22503
22518
|
d["hideZero"] = JSON.parse(
|
|
22504
22519
|
JSON.stringify(seriesData[j].properties.hideZeroValues)
|
|
22505
22520
|
);
|
|
22521
|
+
d["properties"] = seriesData[j].properties;
|
|
22506
22522
|
})
|
|
22507
22523
|
);
|
|
22508
22524
|
};
|
|
@@ -23025,6 +23041,7 @@
|
|
|
23025
23041
|
d["hideZero"] = JSON.parse(
|
|
23026
23042
|
JSON.stringify(seriesData[j].properties.hideZeroValues)
|
|
23027
23043
|
);
|
|
23044
|
+
d["properties"] = seriesData[j].properties;
|
|
23028
23045
|
})
|
|
23029
23046
|
);
|
|
23030
23047
|
};
|
|
@@ -27590,6 +27607,7 @@
|
|
|
27590
27607
|
d["hideZero"] = JSON.parse(
|
|
27591
27608
|
JSON.stringify(seriesData[j].properties.hideZeroValues)
|
|
27592
27609
|
);
|
|
27610
|
+
d["properties"] = seriesData[j].properties;
|
|
27593
27611
|
})
|
|
27594
27612
|
);
|
|
27595
27613
|
};
|