-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Highcharts plugin): use unsafe option for tooltip cell renderer (#…
…545) * fix: use unsafe option for tooltip lines * add story
- Loading branch information
Showing
4 changed files
with
176 additions
and
6 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/plugins/highcharts/__stories__/UnsafeTooltip.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
|
||
import {Meta, Story} from '@storybook/react'; | ||
|
||
import {ChartKit} from '../../../components/ChartKit'; | ||
import {data} from '../mocks/unsafe-tooltip'; | ||
|
||
import {ChartStory} from './components/ChartStory'; | ||
|
||
export default { | ||
title: 'Plugins/Highcharts/UnsafeTooltip', | ||
component: ChartKit, | ||
} as Meta; | ||
|
||
const Template: Story<any> = () => { | ||
return <ChartStory data={data} />; | ||
}; | ||
|
||
export const UnsafeTooltip = Template.bind({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import type {HighchartsWidgetData} from '../types'; | ||
|
||
export const data: HighchartsWidgetData = { | ||
data: { | ||
graphs: [ | ||
{ | ||
title: '<i>Profit</i>', | ||
tooltip: { | ||
chartKitFormatting: true, | ||
chartKitPrecision: 2, | ||
unsafe: true, | ||
}, | ||
data: [ | ||
{ | ||
y: 18451.2728, | ||
dataLabels: { | ||
enabled: false, | ||
}, | ||
label: '', | ||
}, | ||
{ | ||
y: 122490.80080000011, | ||
dataLabels: { | ||
enabled: false, | ||
}, | ||
label: '', | ||
}, | ||
{ | ||
y: 145454.9480999999, | ||
dataLabels: { | ||
enabled: false, | ||
}, | ||
label: '', | ||
}, | ||
], | ||
legendTitle: 'Profit', | ||
colorKey: 'Profit', | ||
colorGuid: null, | ||
connectNulls: false, | ||
yAxis: 0, | ||
colorValue: 'Profit', | ||
color: '#4DA2F1', | ||
dashStyle: 'Solid', | ||
name: '<i>Profit</i>', | ||
}, | ||
{ | ||
title: 'Sales', | ||
tooltip: { | ||
chartKitFormatting: true, | ||
chartKitPrecision: 2, | ||
}, | ||
data: [ | ||
{ | ||
y: 741999.7952999998, | ||
dataLabels: { | ||
enabled: false, | ||
}, | ||
label: '', | ||
}, | ||
{ | ||
y: 719047.0320000029, | ||
dataLabels: { | ||
enabled: false, | ||
}, | ||
label: '', | ||
}, | ||
{ | ||
y: 836154.0329999966, | ||
dataLabels: { | ||
enabled: false, | ||
}, | ||
label: '', | ||
}, | ||
], | ||
legendTitle: 'Sales', | ||
colorKey: 'Sales', | ||
colorGuid: null, | ||
connectNulls: false, | ||
yAxis: 0, | ||
colorValue: 'Sales', | ||
color: '#FF3D64', | ||
dashStyle: 'Solid', | ||
name: 'Sales', | ||
}, | ||
], | ||
categories: ['Furniture', 'Office Supplies', 'Technology'], | ||
}, | ||
config: { | ||
precision: 2, | ||
hideHolidaysBands: true, | ||
enableSum: true, | ||
hideHolidays: false, | ||
normalizeDiv: false, | ||
normalizeSub: false, | ||
manageTooltipConfig: (config) => { | ||
config.lines.forEach((line, index) => { | ||
line.commentText = `Some comment ${index + 1}`; | ||
}); | ||
|
||
return config; | ||
}, | ||
unsafe: true, | ||
}, | ||
libraryConfig: { | ||
chart: { | ||
type: 'line', | ||
zoomType: 'xy', | ||
}, | ||
legend: { | ||
symbolWidth: 38, | ||
}, | ||
xAxis: { | ||
endOnTick: false, | ||
}, | ||
yAxis: { | ||
opposite: false, | ||
labels: { | ||
y: 3, | ||
}, | ||
type: 'linear', | ||
}, | ||
tooltip: {}, | ||
plotOptions: { | ||
series: { | ||
dataGrouping: { | ||
enabled: false, | ||
}, | ||
dataLabels: { | ||
allowOverlap: false, | ||
}, | ||
}, | ||
}, | ||
axesFormatting: { | ||
xAxis: [], | ||
yAxis: [], | ||
}, | ||
enableSum: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters