当图形小时,如何保持固定zingchart的比例尺?

时间:2016-06-23 20:39:32

标签: javascript charts zingchart

当图表非常小时,y轴刻度不在同一距离。 它从6k到9k,右边是6k 8k和10k,距离相同。

出了什么问题?



//zingchart.THEME="classic";
var myConfig = {
  "backgroundColor": "transparent",
  "globals": {
    "fontFamily": "Officina Serif Bold"
  },
  "scaleX": {
    "lineWidth": 0,
    "tick": {
      "alpha": 0
    },
    "zooming": false,
    "zoomTo": null,
    "labels": [
      "Jan",
      "Fev",
      "Mar",
      "Abr",
      "Mai",
      "Jun",
      "Jul",
      "Ago",
      "Set",
      "Out",
      "Nov",
      "Dez"
    ]
  },
  "plot": {
    "animation": {
      "effect": "ANIMATION_EXPAND_BOTTOM",
      "sequence": null,
      "speed": 10
    },
    "aspect": "jumped",
    "bars-overlap": "100%"
  },
  "scaleY": {
    "guide": {
      "alpha": 0.25,
      "lineStyle": "solid",
      "lineColor": "#5a3b77"
    },
    "lineWidth": 0,
    "short": true,
    "tick": {
      "alpha": 0
    }
  },
  "scrollX": false,
  "type": "mixed",
  "series": [{
    "type": "bar",
    "backgroundColor": "#5e36e6",
    "valueBox": {
      "thousandsSeparator": ".",
      "placement": "bottom-in",
      "fontColor": "#fff"
    },
    "z-index": 2,
    "values": [
      2601,
      2662,
      4217,
      5640,
      8019,
      6624,
      null,
      null,
      null,
      null,
      null,
      null
    ]
  }, {
    "type": "bar",
    "backgroundColor": "#0099cd",
    "valueBox": {
      "thousandsSeparator": ".",
      "placement": "top",
      "fontColor": "#fff"
    },
    "z-index": 1,
    "values": [
      null,
      null,
      null,
      null,
      null,
      8509,
      null,
      null,
      null,
      null,
      null,
      null
    ]
  }, {
    "type": "line",
    "lineColor": "#99cc33",
    "lineWidth": 3,
    "stacked": true,
    "stack": 2,
    "marker": {
      "alpha": 0
    },
    "valueBox": {
      "thousandsSeparator": ".",
      "placement": "top"
    },
    "z-index": 3,
    "values": [
      1006,
      2883,
      3409,
      7647,
      6500,
      7990,
      null,
      null,
      null,
      null,
      null,
      null
    ]
  }]
};

zingchart.render({
  id: 'myChart',
  data: myConfig,
  height: 300,
  width: 725
});

<html>

<head>
  <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
  <script>
    zingchart.MODULESDIR = "https://cdn.zingchart.com/modules/";
    ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "ee6b7db5b51705a13dc2339db3edaf6d"];
  </script>
</head>

<body>
  <div id='myChart'></div>
</body>

</html>
&#13;
&#13;
&#13;

View on JSFiddle

0 个答案:

没有答案