Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

feat: adds the option to show values for mixed time-series #1435

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const {
orderDesc,
rowLimit,
seriesType,
showValues,
stack,
truncateYAxis,
yAxisBounds,
Expand Down Expand Up @@ -165,6 +166,18 @@ function createCustomizeSection(label: string, controlSuffix: string): ControlSe
},
},
],
[
{
name: `show_value${controlSuffix}`,
config: {
type: 'CheckboxControl',
label: t('Show Values'),
renderTrigger: true,
default: showValues,
description: t('Whether to display the numerical values within the cells'),
},
},
],
[
{
name: `opacity${controlSuffix}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
EchartsMixedTimeseriesFormData,
EchartsMixedTimeseriesChartTransformedProps,
} from './types';
import { ForecastSeriesEnum, ProphetValue } from '../types';
import { ForecastSeriesEnum } from '../types';
import { parseYAxisBound } from '../utils/controls';
import {
currentSeries,
Expand Down Expand Up @@ -91,6 +91,8 @@ export default function transformProps(
seriesType,
seriesTypeB,
showLegend,
showValue,
showValueB,
stack,
stackB,
truncateYAxis,
Expand Down Expand Up @@ -149,6 +151,7 @@ export default function transformProps(
markerSize,
areaOpacity: opacity,
seriesType,
showValue,
stack,
yAxisIndex,
filterState,
Expand All @@ -162,6 +165,7 @@ export default function transformProps(
markerSize: markerSizeB,
areaOpacity: opacityB,
seriesType: seriesTypeB,
showValue: showValueB,
stack: stackB,
yAxisIndex: yAxisIndexB,
filterState,
Expand Down Expand Up @@ -281,8 +285,7 @@ export default function transformProps(
const prophetValue = !richTooltip ? [params] : params;

const rows: Array<string> = [`${tooltipTimeFormatter(value)}`];
const prophetValues: Record<string, ProphetValue> =
extractProphetValuesFromTooltipParams(prophetValue);
const prophetValues = extractProphetValuesFromTooltipParams(prophetValue);

Object.keys(prophetValues).forEach(key => {
const value = prophetValues[key];
Expand Down
4 changes: 4 additions & 0 deletions plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export type EchartsMixedTimeseriesFormData = QueryFormData & {
rowLimitB: number;
seriesType: EchartsTimeseriesSeriesType;
seriesTypeB: EchartsTimeseriesSeriesType;
showValue: boolean;
showValueB: boolean;
stack: boolean;
stackB: boolean;
yAxisIndex?: number;
Expand Down Expand Up @@ -117,6 +119,8 @@ export const DEFAULT_FORM_DATA: EchartsMixedTimeseriesFormData = {
rowLimitB: TIMESERIES_DEFAULTS.rowLimit,
seriesType: TIMESERIES_DEFAULTS.seriesType,
seriesTypeB: TIMESERIES_DEFAULTS.seriesType,
showValue: TIMESERIES_DEFAULTS.showValue,
showValueB: TIMESERIES_DEFAULTS.showValue,
stack: TIMESERIES_DEFAULTS.stack,
stackB: TIMESERIES_DEFAULTS.stack,
yAxisIndex: 0,
Expand Down