zingchart - Zing Chart Y 比例数据超出框架

标签 zingchart

我向 zingchart Y 比例添加了数据格式以使用 $ ","和 2 位小数,现在文本超出了框架。我尝试更改图表的宽度但无济于事。这里有什么想法吗?

jsfiddle.net/Rodmunera/j1ddL5k6/7

最佳答案

尝试将plotarea对象添加到您的JSON中,并将边距属性添加到该对象。我尝试了 100 像素的边距,它使所有内容都适合 -

var chartJSON = 
        {
            "legend":{
                "border-color":"#bbbbbb",
                "margin-top":10,
                "margin-left":0,
                "drag-handler":"header",
                "item":{
                    "toggle":true,
                    "margin-top":5,
                    "margin-left":5,
                    "margin-right":5,
                    "margin-bottom":5
                },
                "shadow":false,
                "margin-right":0,
                "background-color-2":"#e1e1e1",
                "border-width":1,
                "background-color":"#e1e1e1",
                "draggable":true,
                "minimize":false,
                "header":{
                    "":0,
                    "background-color":"#bbbbbb",
                    "text-align":"center",
                    "font-size":16,
                    "text":"Legend",
                    "font-family":"Lato",
                    "color":"#ffffff",
                    "background-color-2":"#bbbbbb",
                    "font-weight":300
                },
                "layout":"x4",
                "position":"50% 0%",
                "margin-bottom":0
            },
            "tooltip":{
                "visible":true,
                "decimals":2,
                "thousands-separator":",",
                "format":"$%v",
                "text":"$%v"
            },
            "stacked":false,
            "series":[
                {
                    "background-color":"#7fb2f0",
                    "line-color":"#7fb2f0",
                    "text":"Checkout Total",
                    "marker":{
                        "border-color":"#7fb2f0",
                        "background-color":"#7fb2f0",
                        "alpha":1
                    },
                    "background-color-2":"#7fb2f0",
                    "values":[227.04,141.90,56.76,56.76,56.76,141.90,113.52,56.76,28.38,56.76,56.76,28.38,28.38,56.76,141.90,198.66,56.76,56.76,141.90,397.32,85.14,198.66,85.14,255.42,317.82,783.15,646.95,1770.60,3745.50]
                },
                {
                    "background-color":"#bf5a9a",
                    "line-color":"#bf5a9a",
                    "text":"Refunds",
                    "marker":{
                        "border-color":"#bf5a9a",
                        "background-color":"#bf5a9a",
                        "alpha":1
                    },
                    "background-color-2":"#bf5a9a",
                    "values":[0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,56.76,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,272.40,817.20]
                },
                {
                    "background-color":"#efae69",
                    "line-color":"#efae69",
                    "text":"Revenue",
                    "marker":{
                        "border-color":"#efae69",
                        "background-color":"#efae69",
                        "alpha":1
                    },
                    "background-color-2":"#efae69",
                    "values":[200.00,125.00,50.00,50.00,50.00,125.00,100.00,50.00,25.00,50.00,50.00,25.00,25.00,50.00,125.00,175.00,50.00,50.00,125.00,350.00,75.00,175.00,75.00,225.00,280.00,690.00,570.00,1560.00,3300.00]
                }
            ],
            "guide":{
                "line-gap-size":0,
                "visible":true,
                "line-color":"#000000",
                "format":"$%v",
                "line-width":1,
                "tooltip-visible":false,
                "alpha":0,
                "tooltip-text":"%v"
            },
            "alpha":1,
            "scale-y":{
                "zooming":false,
                "decimals":2,
                "thousands-separator":",",
                "negation":"currency",
                "format":"$%v",
                "text":""
            },
            "plotarea":{
                "margin":"100px"
            },
            "plot":{
                "spline":true,
                "negation":"currency",
                "format":"$%v"
            },
            "scale-x":{
                "zooming":false,
                "transform":{
                    "guide":{
                        "visible":false
                    },
                    "item":{
                        "visible":false
                    },
                    "all":"%M %d, %Y",
                    "type":"date"
                },
                "decimals":0,
                "format":"%v",
                "mirrored":0,
                "text":"Shows",
                "values":[1398729600000,1398816000000,1398902400000,1399248000000,1399334400000,1399420800000,1399593600000,1399680000000,1400025600000,1400112000000,1400716800000,1400976000000,1401062400000,1401235200000,1401321600000,1401494400000,1401580800000,1401667200000,1401753600000,1401840000000,1401926400000,1402012800000,1402099200000,1402185600000,1402272000000,1402358400000,1402444800000,1402531200000,1402617600000]
            },
            "type":"area"
        }
zingchart.render({
  id: "myChart",
  height: 300,
  width: 500,
  data: chartJSON
});
<script src="http://www.zingchart.com/playground/lib/zingchart/zingchart-html5-min.js"></script>

<div id="myChart"></div>

我是 ZingChart 团队的成员,因此如果您对此答案或其他 ZingChart 功能有任何疑问,请随时与我们联系。

关于zingchart - Zing Chart Y 比例数据超出框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27045411/

相关文章:

javascript - Zingchart 无法正确绘制超过 10 列的 CSV

javascript - 在 ZingChart 上自定义 x 轴

javascript - 微调哈希以动态创建 ZingCharts 树形图数组

javascript - 使用 ZingChart 的堆积图

charts - 如何在 Zing Chart 中将时区设置为 float ?

charts - ZingChart - 更改 ValueBox 的属性

javascript - 如何使用ZingChart绘制6组维恩图?

charts - 从 Zingchart 中的 CSV 数据中获取系列和值

javascript - 是否可以在 ZingChart 中显示印度系统中的值?

zingchart - 在 Zing 图表中显示 x 轴上的每个值