score:8

Accepted answer

you can make a fake series as follows and provider marker to it.

$(function () {
var chart = new highcharts.chart({
    chart: {
    renderto: 'container',
    type: 'line',
    },
    xaxis: {
        categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']
    },

    plotoptions: {
        series: {
            marker: {
                enabled: true
            }
        }
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalalign: 'middle',

        //borderwidth: 0
    },

    series: [{

        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
        showinlegend : false,


        marker:{enabled:false}

    },{
        name : "testing",
        data : {},
        marker : {symbol : 'square',radius : 12 }
    }
            ]
});
});

working demo : demo

score:1

since highcharts 5 introduced styled mode, you can easily find the symbol elements, and change their attributes. to make the symbol square:

$(".highcharts-legend-item path").attr('stroke-width',16);

http://jsfiddle.net/n3h2totc/23/

score:1

if you'd like a round symbol, you can use this: http://jsfiddle.net/kl5sghrx/3/

chart: {
    events: {
        load: function(){            
		$( ".highcharts-legend-item path" ).each(function( index ) {
			$(this)
			.attr('d','m10.1,15.3l10.1,15.3c-3,0-5.5-2.5-5.5-5.5v0c0-3,2.5-5.5,5.5-5.5h0c3,0,5.5,2.5,5.5,5.5v0 c15.6,12.8,13.2,15.3,10.1,15.3z')
			.attr('fill', $( this ).attr('stroke'))
			.attr('stroke-dasharray','0,0'); 
		});
      	  },
      redraw: function(){            
		$( ".highcharts-legend-item path" ).each(function( index ) {
			$(this)
			.attr('d','m10.1,15.3l10.1,15.3c-3,0-5.5-2.5-5.5-5.5v0c0-3,2.5-5.5,5.5-5.5h0c3,0,5.5,2.5,5.5,5.5v0 c15.6,12.8,13.2,15.3,10.1,15.3z')
			.attr('fill', $( this ).attr('stroke'))
			.attr('stroke-dasharray','0,0'); 
		});
        }
    },
 }

score:2

for rectangular legend we need to set squaresymbol: false.

highcharts.chart('container', {
    chart: {
       type: 'column'
    },

    title: {
       text: 'round legend symbols'
    },

    xaxis: {
       categories: ['jan', 'feb', 'mar', 'apr']
    },

    legend: {
       symbolwidth: 16,
       symbolradius: 0,
       squaresymbol: false
    },

    series: [{
        data: [1, 3, 2, 4]
    }, {
        data: [6, 4, 5, 3]
    }, {
        data: [2, 7, 6, 5]
    }]

});
<script src="https://code.highcharts.com/highcharts.js"></script>

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

score:5

all answers are correct but i found a pretty hack method. replacing legend rectangle symbol with square:

legend: {
   symbolheight: 12,
   symbolwidth: 12,
   symbolradius: 6
}

jsfiddle

score:12

this is a copy of the question: how to access legendsymbols and change their shape in highcharts

it has a similar answer and two others:

first option:

highcharts.seriestypes.line.prototype.drawlegendsymbol = 
highcharts.seriestypes.area.prototype.drawlegendsymbol;

second option:

you can change the stroke-width attribute on the path element.

we can provide functions to highcharts that will be drawn whenever the chart is drawn. since redraw is not called on the first drawing the load event is needed

chart: {
    events: {
        load: function () { 
            $(".highcharts-legend-item path").attr('stroke-width', 10);
        },
        redraw: function () {
            $(".highcharts-legend-item path").attr('stroke-width', 10);
        }
    }
},

score:25

it's possible to achieve square legend symbols via configuration. just set legend.symbolradius value to 0.

jsfiddle demo: https://jsfiddle.net/9bzy2qzq/


Related Query

More Query from same tag