I'm using SmartClient_v121p_2020-04-14_PowerEdition. I have an application where the user clicks on a row in a ListGrid and a window is created with a Gauge component that is built based on the values in ListGrid record that I am passing in. This works great. What I am having trouble with is that when a new row in the ListGrid is selected, I try to update the Gauge using the new values passed in. The code looks something like this:
When the gauge refreshes, the minValue is incorrect. If I click the same record in the grid (so that the gauge refreshes with the same values), it draws correctly. I've been able to reproduce this in the Feature Explorer. To reproduce, go to the Gauge example in the Feature Explorer. https://www.smartclient.com/smartcli...case/?id=Gauge
Replace the code in the click function of the "Add Sector" button with this:
Try it. Click the "Add Sector" button to see the gauge update incorrectly. Min value is 99. Click the "Add Sector" a second time to see the gauge update correctly. Min value is now 2700, as expected.
I know there has to be a minimum of 1 sector. It seems as though setSectors isn't fully replacing the sectors at first.
Thanks for any insight you can provide.
Code:
// Update gauge let gaugeSectors = [ {value: record.value, fillColor: "green"}, {value: record.maxValue, fillColor: "green"} ]; gauge.setMinValue(record.minValue); gauge.setMaxValue(record.maxValue); gauge.setValue(record.value); gauge.setSectors(gaugeSectors);
Replace the code in the click function of the "Add Sector" button with this:
Code:
gauge.setMinValue(2700); gauge.setMaxValue(3000); gauge.setValue(2790); var sectors = [{value: 2790, fillColor: "green"}, {value: 3000, fillColor: "green"}]; gauge.setSectors(sectors);
I know there has to be a minimum of 1 sector. It seems as though setSectors isn't fully replacing the sectors at first.
Thanks for any insight you can provide.
Comment