221
Views
3
Comments
Solved
Highcharts implementing colors using JSON
Application Type
Reactive

I used content from this https://www.highcharts.com/demo/column-stacked ( click on view options button ) for column chart,

I need help to customize the colors using JSON the  sample script in that link



Chart.oml
2023-04-16 15-25-31
Krishnanand Pathak
Solution

Hi @Cynthia Maria ,


To customize the data series colors of the chart.
You need to add color: '#17d0e3' in the series as shown below.

For your chart here is complete Json just replace it with yours.

"chart: {
        type: 'column'
    },
    title: {
        text: 'Major trophies for some English teams',
        align: 'left'
    },
    xAxis: {
        categories: ['Arsenal', 'Chelsea', 'Liverpool', 'Manchester United']
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Count trophies'
        },
        stackLabels: {
            enabled: true,
            style: {
                fontWeight: 'bold',
                color: ( // theme
                    Highcharts.defaultOptions.title.style &&
                    Highcharts.defaultOptions.title.style.color
                ) || 'gray',
                textOutline: 'none'
            }
        }
    },
    legend: {
        align: 'left',
        x: 70,
        verticalAlign: 'top',
        y: 70,
        floating: true,
        backgroundColor:
            Highcharts.defaultOptions.legend.backgroundColor || 'white',
        borderColor: '#CCC',
        borderWidth: 1,
        shadow: false
    },
    tooltip: {
        headerFormat: '<b>{point.x}</b><br/>',
        pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
    },
    plotOptions: {
        column: {
            stacking: 'normal',
            dataLabels: {
                enabled: true
            }
        }
    },
    series: [{
    name: 'BPL',
    data: [3, 5, 1, 13],
    color: '#17d0e3'
  }, {
    name: 'FA Cup',
    data: [14, 8, 8, 12],
    color: '#414c4d'
  }, {
    name: 'CL',
    data: [0, 2, 6, 3],
    color: '#7dda99'
  }]"



Oml is also attached for reference.


Regards
Krishnanand Pathak

Updated_Chart.oml
UserImage.jpg
Cynthia Maria

Thank you Krishna 

2023-04-16 15-25-31
Krishnanand Pathak
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.