Drilldown on an area chart

1 Answer 31 Views
Charts
Alex
Top achievements
Rank 1
Alex asked on 18 Nov 2024, 12:48 PM

This doesn't work with the drilldown example adapted from the KendoReact example of the series graph because having a drilldown factory on each ChartSeriesItem means they can't interact with each other, you need it one layer higher. The only thing I can think to do is to use external variables in React state to track which drilldown you have entered and hide the other ChartSeriesItems

Drilldowns are created by using the props drilldownSeriesFactory and drilldownField on a ChartSeriesItem. When creating a series graph you can all your data and multiple categories under one <ChartSeriesItem /> component. When you want to create an area chart (or line chart) you need to have multiple ChartSeriesItem components, one per data series.

Is there a way to do this purely using KendoReact Charts?

Code below to add some context

<Chart drilldownState={drilldownState} onDrilldown={handleDrilldown}>
    <ChartTitle text="Baseline 06/2024" />
    <ChartCategoryAxis>
         <ChartCategoryAxisItem categories={categories} title={{ text: 'Months' }} baseUnitStep={"auto"} />
    </ChartCategoryAxis>
    <ChartSeries >
        {/* <ChartSeriesItem
                        type="area"
                        stack={true}
                        data={availabilityData}
                        name="Availability"
                        field="value"
                        drilldownField="type"
                        drilldownSeriesFactory={DrilldownByAvailabilitySeries}
           /> */}
          <ChartSeriesItem
                        type="area"
                        data={unavailabilityData}
                        name="Unavailability"
                        field="value"
                        drilldownField="type"
                        drilldownSeriesFactory={DrilldownByAvailabilitySeries}
           />
    </ChartSeries>
    <ChartLegend position="bottom" />
</Chart>

1 Answer, 1 is accepted

Sort by
0
Filip
Telerik team
answered on 20 Nov 2024, 11:33 AM

Hi,  Alex,

Achieving the behaviour purely with the Charts is not feasible, because the component does not natively support managing interactions or drilldowns across multiple components on a shared higher level. 

For the scenario at hand I can recommend using state and ReactContext or a similar state sharing mechanism and the approach that you have discovered is indeed valid.

I hope this helps, but please let me know in case further assistance is required.

Regards,
Filip
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Charts
Asked by
Alex
Top achievements
Rank 1
Answers by
Filip
Telerik team
Share this question
or