ZingChart预览位置和着色

Tes*_*dus 3 javascript 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": [{
Run Code Online (Sandbox Code Playgroud)

mik*_*ltz 5

看起来你从我们的画廊中选择了一个非常复杂的图表进行测试!让我在更简单的图表上向您展示一些示例.

  1. 您可以通过在每个系列对象上设置backgroundColor来设置堆叠颜色.在系列对象中,我们可以添加一个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 
});
Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html>
	<head>
		<script src= "https://cdn.zingchart.com/zingchart.min.js"></script>
	</head>
	<body>
		<div id='myChart'></div>
	</body>
</html>
Run Code Online (Sandbox Code Playgroud)