问题描述
我想绘制2线系列数据ZingChart饲料。下面是我的脚本code。
I am trying to plot 2 line series data in ZingChart feed.Below is my script code.
<script>
var chartData = {
"type":"line",
"refresh": {
"type": "feed",
"transport": "js",
"url": "feed()",
"interval": 1000
},
"series":[
{
"values":[]
},
{
"values":[]
}
]
};
window.onload = function() {
zingchart.render({
id: "chartDiv",
data: chartData,
height: 600,
width: "100%"
});
};
window.feed = function(callback) {
$.ajax({
type: "GET",
dataType: "json",
headers: {
Accept: "application/json",
"Access-Control-Allow-Origin": "*"
},
url: "/PerformanceMonitor/showProcessUsage/${processName}",
success: function (data) {
var mem = data.mem.size/100000;
var tick = {
plot0: parseInt(mem)
};
callback(JSON.stringify(tick));
var tick2 = {
plot1:parseInt(mem/1000)
};
callback(JSON.stringify(tick2));
}
});
};
据被显示,但失去了这个graph.Is正道行性质?有没有更好的方法?后来我打算让用户决定多少地块在runtime.Is被允许在图表有东西在ZingChart,我可以使用?先谢谢了。
It gets displayed , but looses the line nature of the graph.Is this the right way ?Is there a better method?. Later I am planning to let user decide how many plots to be allowed in chart at runtime.Is there something in ZingChart that I can make use of ?Thanks in advance.
推荐答案
在蜱
对象包含每个系列的情节数据。这意味着你可以添加多个地块到该对象。
The tick
object contains the data for each series of a plot. That means you can add multiple plots to that object.
您可以取代一切都在你的成功
回调以下code ...
You can replace everything in your success
callback with the following code...
var mem = data.mem.size/100000;
var tick = {
plot0: parseInt(mem),
plot1: parseInt(mem/1000)
};
callback(JSON.stringify(tick));
如果你想第三个情节加入到系列中,你只需要添加一个 plot2
属性(因为ZingChart的系列有一个0的索引)。
If you wanted to add a third plot to the series, you'd just add a plot2
attribute (since ZingChart's series have a 0-based index).
我在ZingChart队。让我知道如果您有其他问题。
I'm on the ZingChart team. Let me know if you have other questions.
这篇关于ZING饲料1图表绘制多个系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!