score:12

Accepted answer

based on op's comment, striked my previous answer.

as you are doing,

series.name = item; 

and

series.data.push(parsefloat(item));

like wise, you can do,

series.color: '#f6f6f6'

(in your loop you can change color based your conditions )

you can do,

$(document).ready(function() {

    var options = {
        chart: {
            renderto: 'container',
            defaultseriestype: 'bar'
        },
        title: {
            text: 'spiritual gifts results'
        },
        colors: [
            '#3bbee3'
            ],
        xaxis: {
            categories: []
        },

        yaxis: {
            title: {
                text: 'service'
            }
        },
        series: []
    };

    var data = document.getelementbyid("hdn_data");
    // split the lines
    if (data.value != "") {
        var lines = data.value.split('\n');

        // iterate over the lines and add categories or series
        $.each(lines, function(lineno, line) {
            var items = line.split(',');
            // header line containes categories
            if (lineno == 0) {
                $.each(items, function(itemno, item) {
                    if (itemno > 0) options.xaxis.categories.push(item);
                });
            }
            // the rest of the lines contain data with their name in the first position
            else {
                var series = {
                    data: []
                };
                $.each(items, function(itemno, item) {
                    var data = {};
                    if (itemno == 0) {
                        series.name = item;
                    } else {
                        data.y = parsefloat(item);
                        if (itemno <= 3) {
                            data.color = 'gray';
                        }
                        else {
                            data.color = '#3bbee3';
                        }
                        series.data.push(data);
                    }
                });
                options.series.push(series);
              }
            });

            // create the chart
            var chart1 = new highcharts.chart(options);
        }
    });

fiddle

refer this, you can give data in 3 ways. i've used the third one.

score:2

yes, in your push execution you should be able to set color for that point. i am not too familiar with push as we use a precompiled data object that we send. but inside of our .net we set the color (if needed) on a particular point and then send the data object to the chart.

score:16

here is a example

data: [
  { y: 34.4, color: 'red'},   // this point is red
  21.8,                        // default blue
  {y: 20.1, color: '#aaff99'}, // this will be greenish
  20                           // default blue
]                             

Related Query

More Query from same tag