mllamazares
mllamazares

Reputation: 8166

How to set border on a 3d pie highchart?

I have a 3d pie chart using highchart plugin, and I want to put borders in each portion, so I put the following:

borderWidth: 4,
borderColor: "red"

In plotOptions: pie:. But I'm afraid the portions has the border with the same color which there are filled.

There is any way to do this? I don't mind if the border is white, but I need to differenciate the portions.

Here is a jsfiddle where you can try: http://jsfiddle.net/qRvn2/

JS

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'pie',

            options3d: {
                enabled: true,
                alpha: 45,
                beta: 0
            }
        },
        title: {
            text: 'Browser market shares at a specific website, 2014'
        },
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                depth: 35,
                borderWidth: 4,
                borderColor: "red",
                dataLabels: {
                    enabled: true,
                    format: '{point.name}'
                }
            }
        },
        series: [{
            type: 'pie',
            name: 'Browser share',
            data: [
                ['Firefox',   45.0],
                ['IE',       26.8],
                {
                    name: 'Chrome',
                    y: 12.8,
                    sliced: true,
                    selected: true
                },
                ['Safari',    8.5],
                ['Opera',     6.2],
                ['Others',   0.7]
            ]
        }]
    });
});

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-3d.js"></script>

<div id="container" style="height: 400px"></div>

Upvotes: 0

Views: 1414

Answers (2)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

It is a bug, reported to our developers here: https://github.com/highslide-software/highcharts.com/issues/2985

Upvotes: 1

Andrey Borisko
Andrey Borisko

Reputation: 4609

I think you could iterate the points after the chart was initialized and set stroke attribute there

$.each(chart.series[0].data, function(i, point) {
        point.graphic.attr({
            stroke: '#000000'
        });
    });

check the fiddle: http://jsfiddle.net/qRvn2/3/

UPDATE:

There is a problem here, I see that after hover over events it redraws them back. maybe if you could add listeners on such events and redraw them to your style back. Need to think....

Upvotes: 0

Related Questions