问题
I had result that was pulled from the database, and each item in the result is a series in a single chart.
I was able to update that chart but the last element of the result only shows in the chart. What could be the possible problem for this one?
for (i = 0; i < objResult.length; i++) {
temperatureRender.updateSeries([{
name: objResult[i].TankName,
data: objResult[i].TankLogs
}]);
}
It displays the Series but only the last series that i've added.
回答1:
The updateSeries
method overwrites the existing series. So in a for loop (like in the code you've included) you'd only be showing the last element - overriding any previous ones.
Take a look at the appendSeries
method instead which will allow you to add additional series, while keeping the already existing.
Just worth mentioning as well, that this is different from appendData
which allows you to add additional data points to an already existing series.
来源:https://stackoverflow.com/questions/62632770/dynamically-adding-of-series-in-apex-chart