|
|
|
@ -29,13 +29,26 @@ export function Panel({ options, data, width, height, timeZone, timeRange, onCha
|
|
|
|
|
const pod = new ChartwerkGaugePod((chartContainer as any).current, series, chartwerkOptions); |
|
|
|
|
pod.render(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const isLinkActive = !_.isEmpty(options.gauge.link); |
|
|
|
|
const chartClickHandler = (event: React.MouseEvent<HTMLDivElement>) => { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
console.log('click', options); |
|
|
|
|
if (!isLinkActive) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
window.open(options.gauge.link, "_self"); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
|
ref={chartContainer} |
|
|
|
|
className={css` |
|
|
|
|
width: ${width}px; |
|
|
|
|
height: ${height}px; |
|
|
|
|
cursor: ${isLinkActive ? 'pointer' : 'default'} |
|
|
|
|
`}
|
|
|
|
|
onClick={chartClickHandler} |
|
|
|
|
></div> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|