简体   繁体   中英

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

I am creating a polar chart using 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

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); 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();
});

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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