简体   繁体   English

无法使极坐标图填充Anychart中的整个象限

[英]Not able to make the polar charts fill the entire quadrant in Anychart

I am creating a polar chart using AnyChart 我正在使用AnyChart创建极坐标图

在此处输入图片说明

anychart.onDocumentReady(function () {
    // create polar chart
    var chart = anychart.polar();

    var columnSeries = chart.column([
        {x: 'A', value: 28.7},
        {x: 'B', value: 19},
        {x: 'C', value: 17.7},       
        {x: 'D', value: 34.7}
    ]);

    // set series name
    columnSeries.name('Percentage');

    // set title settings
    chart.title()
            .enabled(true)
            .text('Test')
            .padding({bottom: 20});

    // disable y-axis
    chart.yAxis(false);

    // set value prefix for tooltip
    chart.tooltip().valuePrefix('%');

    // set x-scale
    chart.xScale('ordinal');

    // set chart container id
    chart.container('container');

    // initiate chart drawing
    chart.draw();
});

https://playground.anychart.com/gallery/Polar_Charts/Column_Polar_Chart https://playground.anychart.com/gallery/Polar_Charts/Column_Polar_Chart

I would like to get graphs fill up the entire quadrant similar to: 我想让图填满整个象限,类似于:

在此处输入图片说明

How is it possible? 这怎么可能?

You need to sort the points according to your column 您需要根据专栏对点进行排序

// enable sorting points by x
chart.sortPointsByX(true);

Check the live example 查看现场示例

Setting chart.sortPointsByX(true); 设置chart.sortPointsByX(true); fixed the issue: 解决了这个问题:

anychart.onDocumentReady(function () {
    // create polar chart
    var chart = anychart.polar();

    var columnSeries = chart.column([
        {x: 'A', value: 28.7},
        {x: 'B', value: 19},
        {x: 'C', value: 17.7},       
        {x: 'D', value: 34.7}
    ]);

    // set series name
    columnSeries.name('Percentage');

    // set title settings
    chart.title()
            .enabled(true)
            .text('Test')
            .padding({bottom: 20});

    // disable y-axis
    chart.yAxis(false);

    // set value prefix for tooltip
    chart.tooltip().valuePrefix('%');

    chart.sortPointsByX(true);

    // set x-scale
    chart.xScale('ordinal');

    // set chart container id
    chart.container('container');

    // initiate chart drawing
    chart.draw();
});

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM