@@ -4,10 +4,14 @@ import { useComponentCssInjection } from "@salt-ds/styles";
44import { useWindow } from "@salt-ds/window" ;
55import { ChartOptionsProps , useChartOptions } from "./useChartOptions" ;
66import { useChartContextMenu } from "./useChartContextMenu" ;
7+ import cx from "clsx" ;
78
8- import echartCss from "./Chart.css" ;
99import { ItemColorFunction } from "./ChartSeries" ;
1010
11+ import chartCss from "./Chart.css" ;
12+
13+ const classBase = "vuuChart" ;
14+
1115type OptionSettings = {
1216 notMerge : boolean ;
1317} ;
@@ -24,23 +28,26 @@ export interface ChartProps
2428 itemColorFunction ?: ItemColorFunction ;
2529 optionSettings ?: OptionSettings ;
2630 palette ?: string [ ] ;
31+ showTooltip ?: boolean ;
2732}
2833
2934export const Chart = ( {
3035 categoryColumnName,
3136 chartSettings = { useCoarsePointer : true , renderer : "svg" } , // enables clicking near a line and still highlighting it
37+ className,
3238 dataSource,
3339 itemColorFunction,
3440 optionSettings = { notMerge : true } , // don't merge two options together when updating option
3541 palette,
42+ showTooltip,
3643 style = { width : "100%" , height : "100%" } ,
3744 seriesColumnNames,
3845 ...htmlAttributes
3946} : ChartProps ) => {
4047 const targetWindow = useWindow ( ) ;
4148 useComponentCssInjection ( {
4249 testId : "vuu-toast-notification" ,
43- css : echartCss ,
50+ css : chartCss ,
4451 window : targetWindow ,
4552 } ) ;
4653
@@ -52,6 +59,7 @@ export const Chart = ({
5259 palette,
5360 dataSource,
5461 seriesColumnNames,
62+ showTooltip,
5563 } ) ;
5664
5765 const onContextMenu = useChartContextMenu ( { categoryColumnName } ) ;
@@ -102,5 +110,12 @@ export const Chart = ({
102110 }
103111 } , [ option , optionSettings ] ) ;
104112
105- return < div { ...htmlAttributes } ref = { chartRef } style = { style } /> ;
113+ return (
114+ < div
115+ { ...htmlAttributes }
116+ className = { cx ( classBase , className ) }
117+ ref = { chartRef }
118+ style = { style }
119+ />
120+ ) ;
106121} ;
0 commit comments