score:12

Accepted answer

try this:

// 'series' is an array of objects with keys: 
//     - 'name' (string)
//     - 'data' (array)
//     - 'color' (html color code)
var newseriesdata = {
    name: name,
    data: data,
    color: color

};

score:1

it looks to me like you are not looping through the array of data and/or you only have one set of data in data.

score:5

the way to specify a color for a specific series is to define it when you're defining the series. for example:

series: [{
        name: 'john',
        color: '#0066ff',
        dashstyle: 'shortdash',
        data: [
            [date.utc(2010, 0, 1), 29.9],
            [date.utc(2010, 2, 1), 71.5],
            [date.utc(2010, 3, 1), 106.4]
        ]
    },

so essentially when you're creating your series in your drawchart function, do a check for the name, and appropriately assign a color:

var color;
 if(name=="swell height"){
     color="#0066ff";
 }else if(name=="maximum breaking wave height"){
     color="#0066ee";
 }else if(name=="swell period"){
     color="#0066hh";
 }

 var newseriesdata = {
    name: name,
    data: data,
    color: color
 };

Related Query

More Query from same tag