Skip to main content

Dynamically updating chart via addDataset display problem

1 reply [Last post]
peltrie
Offline
Joined: 2006-12-30
Points: 0

Hi

I have "wired" a datatable to a line chart such that an event will retrieve data (formatted as a JSONArray) and populate a table via addRows, and a chart via addDataset.

The problem arises upon display and it depends on the data whether a chart is displayed correctly or not. For example, passing datasets [1, 2, 3], [4, 5, 6], [7, 8, 9] through addDataset, it seems that only dataset [7, 8, 9] is displayed. On the other hand, datasets [7, 8, 9], [4, 5, 6], [1, 2, 3] displays three charts as expected.

(Note, do not take the dataset values literally, they are just examples.)

Whilst debugging, I found that each dataset was displayed correctly, but each call to addDataset would clear the chart screen, so the previously drawn dataset is cleared.

Can someone point me to any example that uses a chart's addDataset function (correctly)?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
peltrie
Offline
Joined: 2006-12-30
Points: 0

Hi

I identified the problem. The widget uses either an id or label (if given) as a key for the dataset, and during processing of addDataset will remove a instance of a dataset with the previously mentioned key (e.g., refreshing a dataset). In my case the dataset label's were identical and hence the problem.