Skip to content

Commit

Permalink
feat(plugin-chart-echarts): subject Add option to rotate label defaul…
Browse files Browse the repository at this point in the history
… 45 (#921)
  • Loading branch information
maloun96 authored and zhaoyongjie committed Nov 26, 2021
1 parent d3bb433 commit df47d95
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const {
truncateYAxis,
yAxisBounds,
zoomable,
xAxisLabelRotation,
} = DEFAULT_FORM_DATA;

const config: ControlPanelConfig = {
Expand Down Expand Up @@ -338,6 +339,24 @@ const config: ControlPanelConfig = {
},
},
],
[
{
name: 'xAxisLabelRotation',
config: {
type: 'SelectControl',
freeForm: true,
clearable: false,
label: t('Rotate x axis label'),
choices: [
[0, '0°'],
[45, '45°'],
],
default: xAxisLabelRotation,
renderTrigger: true,
description: t('Input field supports custom rotation. e.g. 30 for 30°'),
},
},
],
// eslint-disable-next-line react/jsx-key
[<h1 className="section-header">{t('Tooltip')}</h1>],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default function transformProps(chartProps: ChartProps): EchartsProps {
timeGrainSqla,
zoomable,
richTooltip,
xAxisLabelRotation,
}: EchartsTimeseriesFormData = { ...DEFAULT_FORM_DATA, ...formData };

const colorScale = CategoricalColorNamespace.getScale(colorScheme as string);
Expand Down Expand Up @@ -154,6 +155,7 @@ export default function transformProps(chartProps: ChartProps): EchartsProps {
showMinLabel: xAxisShowMinLabel,
showMaxLabel: xAxisShowMaxLabel,
formatter: xAxisFormatter,
rotate: xAxisLabelRotation,
},
},
yAxis: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type EchartsTimeseriesFormData = {
yAxisBounds: [number | undefined | null, number | undefined | null];
zoomable: boolean;
richTooltip: boolean;
xAxisLabelRotation: number;
} & EchartsLegendFormData;

export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
Expand Down Expand Up @@ -90,4 +91,5 @@ export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
xAxisShowMaxLabel: true,
zoomable: false,
richTooltip: true,
xAxisLabelRotation: 45,
};

0 comments on commit df47d95

Please sign in to comment.