File tree 7 files changed +12
-32
lines changed
time-series-chart-web/src
7 files changed +12
-32
lines changed Original file line number Diff line number Diff line change @@ -37,25 +37,23 @@ export const AreaChart = memo(function AreaChart(props: AreaChartContainerProps)
37
37
const lineColorExpression = line . dataSet === "static" ? line . staticLineColor : line . dynamicLineColor ;
38
38
const markerColorExpression = line . dataSet === "static" ? line . staticMarkerColor : line . dynamicMarkerColor ;
39
39
const fillColorExpression = line . dataSet === "static" ? line . staticFillColor : line . dynamicFillColor ;
40
- const pts =
41
- line . aggregationType === "none" ? dataPoints : aggregateDataPoints ( line . aggregationType , dataPoints ) ;
42
40
43
41
return {
44
42
type : "scatter" ,
45
43
fill : "tonexty" ,
46
44
fillcolor : fillColorExpression
47
- ? getExpressionValue < string > ( fillColorExpression , pts . dataSourceItems )
45
+ ? getExpressionValue < string > ( fillColorExpression , dataPoints . dataSourceItems )
48
46
: undefined ,
49
47
mode : line . lineStyle === "line" ? "lines" : "lines+markers" ,
50
48
line : {
51
49
shape : line . interpolation ,
52
50
color : lineColorExpression
53
- ? getExpressionValue < string > ( lineColorExpression , pts . dataSourceItems )
51
+ ? getExpressionValue < string > ( lineColorExpression , dataPoints . dataSourceItems )
54
52
: undefined
55
53
} ,
56
54
marker : {
57
55
color : markerColorExpression
58
- ? getExpressionValue < string > ( markerColorExpression , pts . dataSourceItems )
56
+ ? getExpressionValue < string > ( markerColorExpression , dataPoints . dataSourceItems )
59
57
: undefined
60
58
}
61
59
} ;
Original file line number Diff line number Diff line change @@ -46,16 +46,13 @@ export const BarChart = memo(function BarChart(props: BarChartContainerProps): R
46
46
useCallback ( ( dataSeries , dataPoints , { getExpressionValue } ) => {
47
47
const barColorExpression =
48
48
dataSeries . dataSet === "static" ? dataSeries . staticBarColor : dataSeries . dynamicBarColor ;
49
- const pts =
50
- dataSeries . aggregationType === "none"
51
- ? dataPoints
52
- : aggregateDataPoints ( dataSeries . aggregationType , dataPoints ) ;
49
+
53
50
return {
54
51
type : "bar" ,
55
52
orientation : "h" ,
56
53
marker : {
57
54
color : barColorExpression
58
- ? getExpressionValue < string > ( barColorExpression , pts . dataSourceItems )
55
+ ? getExpressionValue < string > ( barColorExpression , dataPoints . dataSourceItems )
59
56
: undefined
60
57
}
61
58
} ;
Original file line number Diff line number Diff line change @@ -70,16 +70,13 @@ export const BubbleChart = memo(
70
70
) ;
71
71
const markerColorExpression =
72
72
line . dataSet === "static" ? line . staticMarkerColor : line . dynamicMarkerColor ;
73
- const pts =
74
- line . aggregationType === "none"
75
- ? dataPoints
76
- : aggregateDataPoints ( line . aggregationType , dataPoints ) ;
73
+
77
74
return {
78
75
type : "scatter" ,
79
76
mode : "markers" ,
80
77
marker : {
81
78
color : markerColorExpression
82
- ? getExpressionValue < string > ( markerColorExpression , pts . dataSourceItems )
79
+ ? getExpressionValue < string > ( markerColorExpression , dataPoints . dataSourceItems )
83
80
: undefined ,
84
81
symbol : [ "circle" ] ,
85
82
size,
Original file line number Diff line number Diff line change @@ -46,14 +46,10 @@ export const ColumnChart = memo(function ColumnChart(props: ColumnChartContainer
46
46
useCallback ( ( dataSeries , dataPoints , { getExpressionValue } ) => {
47
47
const columnColorExpression =
48
48
dataSeries . dataSet === "static" ? dataSeries . staticBarColor : dataSeries . dynamicBarColor ;
49
- const pts =
50
- dataSeries . aggregationType === "none"
51
- ? dataPoints
52
- : aggregateDataPoints ( dataSeries . aggregationType , dataPoints ) ;
53
49
return {
54
50
marker : {
55
51
color : columnColorExpression
56
- ? getExpressionValue < string > ( columnColorExpression , pts . dataSourceItems )
52
+ ? getExpressionValue < string > ( columnColorExpression , dataPoints . dataSourceItems )
57
53
: undefined
58
54
}
59
55
} ;
Original file line number Diff line number Diff line change @@ -35,22 +35,19 @@ export const LineChart = memo(
35
35
const lineColorExpression = line . dataSet === "static" ? line . staticLineColor : line . dynamicLineColor ;
36
36
const markerColorExpression =
37
37
line . dataSet === "static" ? line . staticMarkerColor : line . dynamicMarkerColor ;
38
- const pts =
39
- line . aggregationType === "none"
40
- ? dataPoints
41
- : aggregateDataPoints ( line . aggregationType , dataPoints ) ;
38
+
42
39
return {
43
40
type : "scatter" ,
44
41
mode : line . lineStyle === "line" ? "lines" : "lines+markers" ,
45
42
line : {
46
43
shape : line . interpolation ,
47
44
color : lineColorExpression
48
- ? getExpressionValue < string > ( lineColorExpression , pts . dataSourceItems )
45
+ ? getExpressionValue < string > ( lineColorExpression , dataPoints . dataSourceItems )
49
46
: undefined
50
47
} ,
51
48
marker : {
52
49
color : markerColorExpression
53
- ? getExpressionValue < string > ( markerColorExpression , pts . dataSourceItems )
50
+ ? getExpressionValue < string > ( markerColorExpression , dataPoints . dataSourceItems )
54
51
: undefined
55
52
}
56
53
} ;
Original file line number Diff line number Diff line change @@ -57,11 +57,7 @@ export const TimeSeries = memo(
57
57
function TimeSeries ( props : TimeSeriesContainerProps ) : ReactElement | null {
58
58
const chartLines = usePlotChartDataSeries (
59
59
props . lines ,
60
- useCallback ( ( line , dataPoints ) => {
61
- const pts =
62
- line . aggregationType === "none"
63
- ? dataPoints
64
- : aggregateDataPoints ( line . aggregationType , dataPoints ) ;
60
+ useCallback ( line => {
65
61
return {
66
62
mode : line . lineStyle === "line" ? "lines" : "lines+markers" ,
67
63
fill : line . enableFillArea ? "tonexty" : "none" ,
Original file line number Diff line number Diff line change 1
- // packages/shared/charts/src/utils/aggregations.ts
2
1
import { Datum } from "plotly.js-dist-min" ;
3
2
import { PlotChartDataPoints } from "../hooks/usePlotChartDataSeries" ;
4
3
You can’t perform that action at this time.
0 commit comments