diff --git a/src/lib/components/echarts/line-chart.tsx b/src/lib/components/echarts/line-chart.tsx index 7fa3f0e..631a8d0 100644 --- a/src/lib/components/echarts/line-chart.tsx +++ b/src/lib/components/echarts/line-chart.tsx @@ -13,6 +13,7 @@ const LineChart: React.FC = (props) => { seriesData, xAxisData, yAxisName, + yAxisMax, height, width, labelFormatter, @@ -96,6 +97,9 @@ const LineChart: React.FC = (props) => { return { ...item, ...lineItemConfig, + // a series whose data marks isolated points (per-item symbol) + // opts back into symbol rendering + showSymbol: item.showSymbol ?? lineItemConfig.showSymbol, smooth: smooth, itemStyle: { ...lineItemConfig.itemStyle, @@ -132,6 +136,7 @@ const LineChart: React.FC = (props) => { yAxis: { ...options.yAxis, name: yAxisName, + max: yAxisMax ?? undefined, nameTextStyle: { fontSize: 12, align: 'right' @@ -147,6 +152,7 @@ const LineChart: React.FC = (props) => { seriesData, xAxisData, yAxisName, + yAxisMax, title, smooth, titleOptions, diff --git a/src/lib/components/echarts/types.ts b/src/lib/components/echarts/types.ts index d393930..c130625 100644 --- a/src/lib/components/echarts/types.ts +++ b/src/lib/components/echarts/types.ts @@ -29,6 +29,9 @@ export interface ChartProps { smooth?: boolean; color?: string; yAxisName?: string; + // pins the y-axis ceiling (e.g. 100 for percentage charts); left + // unset, echarts scales the axis to the data + yAxisMax?: number; stack?: string | false; gaugeConfig?: { radius?: string;