Category: Question and Answers
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Update Graph Series Data using appsmith.store

Issue

I am trying to update a chart's Series Data dynamically using a NumberSlider Widget, but I am encountering an error when deploying the app. The appsmith.store.graphData variable is undefined, and I'm not sure why. I need to find a solution to display different data in the chart based on the slider value without using appsmith.store.

Resolution

The solution to the error of appsmith.store.graphData being undefined when deploying the app is to use conditional rendering to ensure that the data is available before rendering the chart. The Series Data property of the chart widget can be modified to use appsmith.store.graphData if it exists, or an empty array if it doesn't.

{{appsmith.store.graphData ? appsmith.store.graphData : []}}

Alternatively, the NumberSlider widget's value can be used directly in the Series Data property of the chart widget by calling a function that fetches data based on the slider value. The function should be replaced with the actual function that fetches data.

{{fetchDataBasedOnSliderValue(NumberSlider1.value)}}