ZingChart预览位置和着色



我是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来设置堆叠颜色。在series对象中,我们还可以添加一个hoverState对象来控制鼠标悬停的颜色。

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

  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>

最新更新