Search code examples
javascripthighchartsbubble-chart

How to implement Highchart in AngularJS.i was trouble with implementation highchart in angular


How to implement this code in AngularJS ?

It was not working properly in AngularJS files

http://jsfiddle.net/Kondaldurgam/qkr4dqe3/

How to implement Highchart in AngularJS ?

 Highcharts.chart('container', {

chart: {
    type: 'bubble',
    plotBorderWidth: 1,
    zoomType: 'xy'
},

title: {
    text: 'Highcharts bubbles with radial gradient fill'
},

xAxis: {
    type:'',
    gridLineWidth: 1
},

yAxis: {
    startOnTick: false,
    endOnTick: false
},

series: [{
    data: [
        [9, 81, 63],
        [98, 5, 89],
        [51, 50, 73],
        [41, 22, 14],
        [58, 24, 20],
        [78, 37, 34],
        [55, 56, 53],
        [18, 45, 70],
        [42, 44, 28],
        [3, 52, 59],
        [31, 18, 97],
        [79, 91, 63],
        [93, 23, 23],
        [44, 83, 22]
    ],
    marker: {
        fillColor: {
            radialGradient: { cx: 0.4, cy: 0.3, r: 0.7 },
            stops: [
                [0, 'rgba(255,255,255,0.5)'],
                [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0.5).get('rgba')]
            ]
        }
    }
}, ]

});

Solution

  • According to the information you provide in both fiddles it looks like in xAxis property you are missing 'category':

    xAxis: {
            type: "category", // <==== here
            gridLineWidth: 1
        }
    

    here is the working fiddle