gpt4 book ai didi

javascript - ZingChart 预览位置和着色

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:02:30 24 4
gpt4 key购买 nike

我是 Zingchart 的新手,我遇到了一些问题。

我想要一个带有第二个图表(或此处为预览)的堆叠条形图。

1.) 当我为它设置颜色时出现堆叠问题,我在图表中看不到差异 - 为什么?。 -(是否可以将颜色应用于每个单独的条形堆叠?)

2.) 只有在单击背景而不是数据集时才可以缩放。由于我设置了很多数据,因此无法缩放。我该怎么做才能对充满数据的图表应用缩放?

3.) 如何正确设置预览/图表的位置?无论我如何设置 preview.position,只有 y 发生变化,高度或 x 值没有变化。这也很愚蠢,因为我看不到预览的正确句柄。也尝试用边距调整它,但也没有成功。我希望预览位于大图表之上。

这是我正在玩的:http://jsfiddle.net/z1zwg6ae/1/

     "graphset": [{
"type": "bar",
"x": "1%",
"y": "25%",
"height": "100%",
"background-color": "#fff",

"plot": {
"stacked": true,
"stack-type": "100%"
},

"scale-x": {
"line-color": "#555",
"line-width": "4px",

"zooming": true,
"guide": {
"visible": false
},
"tick": {
"line-color": "#333",
}
},
"chart": {
"position": "0 0"

},
"scale-y": {
"min-value": 0,
"max-value": 100
},
"scroll-x": {
"bar": {
"background-color": "#777"
},
"handle": {
"background-color": "#76DF20"
}
},
"zoom": {
"background-color": "#20DFC6"
},
"plot": {
"line-width": 10,
"max-trackers": 9999,
"mode": "normal",
"js-rule": "myfunc()",
"shadow": false,
"marker": {
"type": "none"
}
},
"preview": {
"height": 100,
"position": "200 100",
"width": "90%"
},

"plotarea": {
"adjust-layout": true,
"margin-right": 35
},
"series": [{

最佳答案

看起来您从我们的图库中选择了一个相当复杂的图表来进行测试!让我在一个更简单的图表上向您展示一些示例。

  1. 您可以通过在每个系列对象上设置 backgroundColor 来设置堆叠颜色。在系列对象中,我们可以添加一个 hoverState 对象来控制鼠标悬停颜色。

  2. 开箱即用的缩放只能通过单击并拖动背景来控制。您可以使用预览窗口,或连接到 zoom methods of the api创建放大图表的功能。 .您可以在库外的外部 div 中使用这些方法,或者监听 node_click。事件并将缩放方法附加到它以复制您想要实现的目标。

  3. 可以使用预览对象中的位置和边距属性修改预览窗口的位置。

我是 ZingChart 团队的一员,如有任何其他问题,请随时与我们联系!

var myConfig = {
type: "bar",
plot:{
stacked:true,
stackType:"normal"
},
preview : {
position : "50% 0%",
margin : "10 50 80 50",
height: 50
},
plotarea : {
margin : "90 50 50 50"
},
scaleX : {
zooming : true
},
scaleY : {
zooming : true
},
series: [
{
values :[20,40,25,50,15,45,33,34],
backgroundColor : "#3386ff",
hoverState :{
backgroundColor : "#2c61ad",
}
},
{
values:[5,30,21,18,59,50,28,33],
backgroundColor : "#1963bc",
hoverState :{
backgroundColor : "#4988e4",
}
},
{
values:[30,5,18,21,33,41,29,15],
backgroundColor : "#44d0e9",
hoverState :{
backgroundColor : "#a6f1ff",
}
}
]
};

zingchart.render({
id : 'myChart',
data : myConfig,
height: 400,
width: 600
});
<!DOCTYPE html>
<html>
<head>
<script src= "https://cdn.zingchart.com/zingchart.min.js"></script>
</head>
<body>
<div id='myChart'></div>
</body>
</html>

关于javascript - ZingChart 预览位置和着色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33511583/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com