Skip to content

Commit

Permalink
fix(Highcharts plugin): fix area trigger overlapping (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
korvin89 authored Nov 14, 2023
1 parent c308f4a commit cc35147
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 9 deletions.
57 changes: 57 additions & 0 deletions src/plugins/highcharts/__stories__/area/WithThreshold.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';
import {Meta, Story} from '@storybook/react';
import {ChartKit} from '../../../../components/ChartKit';
import type {HighchartsWidgetData} from '../../types';
import {ChartStory} from '../components/ChartStory';

export default {
title: 'Plugins/Highcharts/Area',
component: ChartKit,
} as Meta;

const data = {
data: {
graphs: [
{
data: [
29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4,
],
},
],
},
config: {
hideHolidaysBands: true,
},
libraryConfig: {
chart: {
type: 'area',
},
plotOptions: {
series: {
threshold: 100,
},
},
xAxis: {
categories: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
},
},
} as HighchartsWidgetData;

const Template: Story<any> = () => {
return <ChartStory data={data} height="300px" />;
};

export const WithThreshold = Template.bind({});
82 changes: 82 additions & 0 deletions src/plugins/highcharts/__stories__/combined/AreaLine.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import React from 'react';
import {Meta, Story} from '@storybook/react';
import {ChartKit} from '../../../../components/ChartKit';
import type {HighchartsWidgetData} from '../../types';
import {ChartStory} from '../components/ChartStory';

export default {
title: 'Plugins/Highcharts/Combined Charts',
component: ChartKit,
} as Meta;

const data = {
data: {
graphs: [
{
data: [29.9, 40, 30.4, 50, 60, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
},
{
type: 'area',
data: [
144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2,
],
yAxis: 1,
},
],
},
config: {
hideHolidaysBands: true,
},
libraryConfig: {
chart: {
marginRight: 80,
zoomType: 'xy',
},
xAxis: {
categories: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
endOnTick: false,
startOnTick: false,
},
yAxis: [
{
lineWidth: 1,
title: {
text: 'Primary Axis',
},
labels: {
enabled: true,
},
},
{
lineWidth: 1,
opposite: true,
title: {
text: 'Secondary Axis',
},
},
],
tooltip: {
shared: true,
valueDecimals: 0,
},
},
} as HighchartsWidgetData;

const Template: Story<any> = () => {
return <ChartStory data={data} />;
};

export const AreaLine = Template.bind({});
7 changes: 0 additions & 7 deletions src/plugins/highcharts/renderer/helpers/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -1718,13 +1718,6 @@ export function prepareConfig(data, options, isMobile, holidays) {
},
},
},
area:
series.length === 1
? {
trackByArea: false,
stickyTracking: true,
}
: {},
},
xAxis: {
crosshair: options.splitTooltip
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/highcharts/renderer/helpers/config/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ const options = {
area: Object.assign(
{
boostThreshold: 0, // https://jsfiddle.net/2ahd7c9b
trackByArea: true,
stickyTracking: false,
},
first,
wizardGraphDataLabels,
Expand Down

0 comments on commit cc35147

Please sign in to comment.