Dynamically adding of Series in Apex Chart

若如初见. 提交于 2021-02-11 14:16:03

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!