【发布时间】:2020-03-25 19:56:45
【问题描述】:
我试图让 X 轴(时间)缩放保持一致。根据我输入图表的范围(可能是 1 小时,也可能是 11 小时),间距不会保持一致。如下例所示,在两小时内,您会在 2:30 标记处看到中心标签,但出于某种原因,ZingChart 选择 2:40 作为中间标签。
我尝试过使用“max-labels”属性以及自动调整,但没有运气。
当前代码:
window.addEventListener('load', function()
{
//zingchart.EXPORTURL = 'http://naskep/zing/export/index.php';
zingchart.render(
{
id: "myChart",
width: "100%",
height: "700",
data: {
type: 'line',
backgroundColor: '#FFFFFF',
title: {
text: "Historical Trending Demo"
},
plotarea: {
margin: '50 100'
},
plot: {
marker: {size: '1'},
preview: {
type: "area", //"area" (default) or "line"
'line-color': "#0099ff",
'line-width': 2,
'line-style': "dotted",
'background-color': "#99cc00",
alpha: 1,
'alpha-area': 0.1
}
},
scaleX: {
//labels: myLabels,
autoFit: false,
transform: {
type: "date",
all: "%m/%d/%y %g:%i:%s %a"
},
'max-labels': 6,
step: "minute",
'max-value': <?php echo $endtime; ?>,
zooming: true,
},
scaleY: {
zooming: false,
minorGuide: {
lineColor: '#7F8C8D',
lineWidth: 3
},
minorTick: {
lineColor: '#7F8C8D'
},
minorTicks: 1,
tick: {
lineColor: '#7F8C8D',
lineWidth: 1
}
},
crosshairX: {
marker: {
alpha: 0.5,
size: '7px'
},
plotLabel: {
borderRadius: '3px',
multiple: true
},
scaleLabel: {
backgroundColor: '#53535e',
borderRadius: '3px'
}
},
preview: {
adjustLayout: true,
borderColor: '#000000',
backgroundColor: '#EAEDED',
label: {
fontColor: '#CD5C5C'
},
live: false,
mask: {
backgroundColor: '#7F8C8D'
}
},
series: [{
values: myData
}]
}
})
}
);
</script>```
【问题讨论】:
标签: javascript zingchart