Skip to content

Commit

Permalink
feat: adds the option to show values for mixed time-series (apache#1435)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina authored and zhaoyongjie committed Nov 17, 2021
1 parent 3cf4273 commit 8aece1c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
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
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

0 comments on commit 8aece1c

Please sign in to comment.