I'm Using a Chart to show the trend of some values, such as current, voltage, etc. Each of the parameters has a Minimum and Maximum value. So, I show the minimum and maximum values as straight lines, and the actual values are shown as normal grids. I'll add the reference image below. Sometimes the actual values could be less than the minimum values and Sometimes greater than the Maximum value. But we need to Show the Exact values between the maximum and minimum values. That's why I wrote a script in the ConfigureChart extension function.
In this code, I set the lower and Upper Bound values of the Y-axis, and those values are also updated in the Chart Customizer. But now populate in the Chart component. Whenever I click that chart and select some areas in the Chart panel, the changes have been updated. Otherwise, the changes couldn't be updated. And I tried to refresh that component, but that also not working. Could anyone can help me to find out the solution to this?
The Classic Chart component doesn't run configureChart for data changes. The proper solution is to use customized ValueMarker instances that look at your custom props every time they are asked for their value, and to replace the range axis with a custom Axis that does similar with your bounds.
Sorry, @pturmel. That slightly confuses me because they are changing the plot color. But my wish is to change or refresh the plot to populate that data into the chart. I also have one checkBox component that enables and disables the ranges. The Max, Min, and Target range lines should be shown when the CheckBos has been enabled. Once the CheckBox has been disabled the Min, Max, And Target lines should be disappeared. I have Completed this part. But that data only not populating In the chart. Could you give an example of it? That would be helpful for me.
The result you're looking for could be achieved by running this from the propertyChange event handler of the check box component instead of the configureChart extension function of the chart:
Example:
if event.propertyName == 'selected':
chart = event.source.parent.parent.getComponent('Chart').chart
if event.newValue:
chart.plot.rangeAxis.setAutoRange(False)
chart.plot.rangeAxis.setLowerBound(float(event.source.parent.parent.graph_1_min))
chart.plot.rangeAxis.setUpperBound(float(event.source.parent.parent.graph_1_max))
else:
chart.plot.rangeAxis.setAutoRange(True)