在Zingchart中创建混合图表时,我们可以使用values数组传递类型属性值.但我不确定何时从CSV读取数据如何实现.我想创建混合图表,如下面的小提琴链接,但数据将从csv文件中读取.
var myConfig =
{
"type":"mixed",
"series":[
{
"values":[51,53,47,60,48,52,75,52,55,47,60,48],
"type":"bar",
"hover-state":{
"visible":0
}
},
{
"values":[69,68,54,48,70,74,98,70,72,68,49,69],
"type":"line"
}
]
}
zingchart.render({
id : 'myChart',
data : myConfig,
height: 500,
width: 725
});Run Code Online (Sandbox Code Playgroud)
<script src="https://cdn.zingchart.com/zingchart.min.js"></script>
<div id="myChart"></div>Run Code Online (Sandbox Code Playgroud)
我访问了ZingChart的文档,并通过调用多个这样的渲染函数来了解渲染多个图表的方法.
zingchart.render({
id:'chartDiv1',
data:myChart1,
height:300,
width:500
});
zingchart.render({
id:'chartDiv2',
data:myChart2,
height:300,
width:500
});
zingchart.render({
id:'chartDiv3',
data:myChart3,
height:300,
width:500
});
zingchart.render({
id:'dashboardDiv',
data:myDashboard,
height:500,
width:700
});
Run Code Online (Sandbox Code Playgroud)
但是在我的代码中,我想编写更少的代码,这对我来说应该更有效,因为它也是由我的老板指导的.
所以我的问题是我可以通过调用一个渲染函数来渲染多个图表吗?就像是:
zingchart.render({
id:{'chartDiv1','chartDiv2','chartDiv3','chartDiv4'},
data:{myChart1,myChart2,myChart3,myChart4},
height:300,
width:500
});
Run Code Online (Sandbox Code Playgroud)
提前致谢.
html文件
<zingchart id="timesheet-bar-chart" zc-json="myObj"></zingchart>
Run Code Online (Sandbox Code Playgroud)
在controller.js中
$scope.myObj = {
"type": "bar",
"utc": true,
"plotarea":{
"margin":'dynamic'
},
"plot":{
"stacked":true,
"stack-type":"normal" /* Optional specification */
},
"scaleX":{
"transform":{
"type":"date",
"all":"%d %M",
"item": {
"visible":false
}
},
},
"series":[{
"values": $scope.barValues,
"backgroundColor":"#f15662"
}]
};
zingchart.render({
id : 'timesheet-bar-chart',
height: 400,
width: "100%"
});
Run Code Online (Sandbox Code Playgroud)
在$ scope.barValues中,数据以下面的格式动态添加
[[[1478025000000,10],[1477938600000,20],[1478889000000,30]]]
有人可以向我解释为什么第一个系列价值框没有出现但其余部分是?我现在一直在撞墙上一小时.我在下面伪造了数据,但结果是一样的.先感谢您!
var ctFin = 60;
var myConfig = {
"type": "hbar",
"font-family": "proxima_nova_rgregular",
"title": {
"text": "MINUTES <b>IN ZONES</b>",
"font-family": "proxima_nova_rgregular",
"background-color": "none",
"font-color": "#39393d",
"font-size": "22px",
"adjustLayout": true,
"height": "35px",
"padding-bottom": "23px"
},
"plot": {
"bars-overlap": "1%",
"borderRadius": "0 3px 3px 0",
"hover-state": {
"visible": false
},
"animation": {
"delay": 300,
"effect": 4,
"speed": "500",
"method": "0",
"sequence": "3"
}
},
"plotarea": {
"height": "99px",
"border-left": "3px solid #39393d",
"padding-left": "3px",
"margin": "0 0 0 3px"
},
"scale-x": { …Run Code Online (Sandbox Code Playgroud)有没有办法在ZingChart中动态生成条形颜色?在屏幕截图中,条形图中生成两种颜色,我想获得条形图中使用的颜色列表.

html文件
<zingchart id="timesheet-bar-chart" zc-values="barValues" zc- json="myObj"></zingchart>
Run Code Online (Sandbox Code Playgroud)
调节器
$scope.myObj = {
"type": "bar",
"plot":{
"stacked":true,
"stack-type":"normal" /* Optional specification */
},
"scale-x":{
"transform":{
"type":"date",
"all":"%d %M",
"item": {
"visible":false
}
},
"values":$scope.bar_x_axis,
},
};
Run Code Online (Sandbox Code Playgroud)
和barValues是一个整数值列表.
我使用ZingChart将数据显示为图表。在char中,我显示了从服务器获取的时间后的数据。默认情况下,ZingChart设置为遵循客户端时间。
我发现我们只能将图表中的时区设置为整数值。但是,某些时区是UTC + 10:30,UTC + 04:30 ...
那么我们如何将时区设置为显示正确时间的ZingChart?如果那一天有夏令时,我该如何更正。