Why does the StockChart legend behaviour differently?

1 Answer 45 Views
Charts
Tony
Top achievements
Rank 1
Tony asked on 01 Dec 2022, 09:16 AM
The stock chart legend behaviours differently from the standard chart component, when you hover over the label the series are not highlighted. Heres a stackBlitz demo as an example https://stackblitz.com/edit/react-y7gch7?file=app%2Fmain.jsx,app%2Fstock-data.json
Tony
Top achievements
Rank 1
commented on 01 Dec 2022, 11:14 AM | edited

Also within the normal chart component, you could pass a ref so you could use the download functionality, this is no longer viable with the stock chart. Is this by design?

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 05 Dec 2022, 06:55 AM

Hello Tony,

The highlight issue is due to the "partialRedraw" being set to "true", which prevents the highlighted state to be rendered. Changing it to "false" will resolve the issue;

As for the ref, you could still use useRef for the StockChart as well:

  const chartRef = React.useRef();
  React.useEffect(()=>{
    console.log(chartRef.current);
  },[])
  return (
    <StockChart onNavigatorFilter={onNavigatorChange} partialRedraw={false} ref={chartRef}>

Hope this helps.

 

Regards,
Konstantin Dikov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tony
Top achievements
Rank 1
commented on 05 Dec 2022, 09:09 AM

Hi Konstantin, thanks for the reply. Ideally, I would like to partially redraw due to the performance benefits. For the Ref, it was a typescript error my apologies. However, the `exportVisual` doesn't work as expected with the stock chart. FYI you cannot use onNavigationFilter with partialRedraw false as it throws an error. 

With regards to the chart-saving ref, I think there may be a Bug. I have included my blitz but when the navigator has a small selection and we use save the navigator suggests it is the whole series even though we use a small slither for the series. 
https://stackblitz.com/edit/react-y7gch7-tw62nc?file=app%2Fmain.jsx 

To reproduce slide the navigator to show part of the whole series and click save.  Observe the chart is correct but the navigator doesn't show which part of the series it is showing unless you work it out yourself. 

Konstantin Dikov
Telerik team
commented on 07 Dec 2022, 07:24 AM

I made more tests and indeed, setting the partialRedraw to "false" will throw an error when using onNavigationFilter, which means that highlight issue should be considered a limitation with the current implementation.

As for the selector in the navigation, the selector is an external element that is not part of the Chart's drawing surface, which is why it is not exported. For this particular problem I will have to consult with the developers team to see if we can log this as enhancement and change the rendering in a way that will allow the export of the navigator selection. For now, what I could suggest is to maybe conditionally hide the navigator (by using a variable in the state and toggle it before exporting):

<ChartNavigator visible={showNavigator}>

 Please excuse us for any inconvenience caused by those limitations.
Tags
Charts
Asked by
Tony
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or