fix(plugin-chart-echarts): render horizontal categories from top (#23273)

This commit is contained in:
Ville Brofeldt
2023-03-06 11:25:52 +02:00
committed by GitHub
parent 42980a69a7
commit 71a9d0d403
3 changed files with 165 additions and 0 deletions

View File

@@ -87,6 +87,44 @@ describe('EchartsTimeseries transformProps', () => {
);
});
it('should transform chart props for horizontal viz', () => {
const chartProps = new ChartProps({
...chartPropsConfig,
formData: {
...formData,
orientation: 'horizontal',
},
});
expect(transformProps(chartProps as EchartsTimeseriesChartProps)).toEqual(
expect.objectContaining({
width: 800,
height: 600,
echartOptions: expect.objectContaining({
legend: expect.objectContaining({
data: ['San Francisco', 'New York'],
}),
series: expect.arrayContaining([
expect.objectContaining({
data: [
[1, 599616000000],
[3, 599916000000],
],
name: 'San Francisco',
}),
expect.objectContaining({
data: [
[2, 599616000000],
[4, 599916000000],
],
name: 'New York',
}),
]),
yAxis: expect.objectContaining({ inverse: true }),
}),
}),
);
});
it('should add a formula annotation to viz', () => {
const formula: FormulaAnnotationLayer = {
name: 'My Formula',