Combo chart bar color

958 views
Skip to first unread message

armon000

unread,
Aug 12, 2013, 9:00:17 AM8/12/13
to google-visua...@googlegroups.com
hello every one i have  combochart, i want to change the color of my bar. i try it by

colors: ['red', 'maroon', '#338067', '#FC53D2']

or:

series: {
    0: {
        color: 'red'
    },
    1: {
        color: 'maroon'
    },
    2: {
        color: '#338067'
    },
    3: {
        color: '#FC53D2'
    }
}
 but it doesn't works !!!!!
this is my code ...

 ComboChart = new google.visualization.ChartWrapper({
                    chartType: "ComboChart",
                    containerId: "combochart",
                    options: {
                        chartArea: {
                            height: "80%",
                            width: "70%",
                        },
                       
                        seriesType: "bars",
                        isStacked:"True",
                    },
                    series: {
                        0: {  // set the options for the first series (columns)
                            type: "bars",
                            targetAxisIndex: 0
                        },
                        1: {  // set the options for the second series (line)
                            type: "line",
                            targetAxisIndex: 1
                        },
                        2: {  // set the options for the second series (line)
                            type: "line",
                            targetAxisIndex: 2
                        },
                        3: {  // set the options for the second series (line)
                            type: "line",
                            targetAxisIndex: 3
                        }
                    }
                });

could you help my ?????

Sergey Grabkovsky

unread,
Aug 12, 2013, 9:48:33 AM8/12/13
to google-visua...@googlegroups.com
Hi, you can change the color of a series by doing series: {0: {color: 'red'}}. I just tried this and it worked. Can you link to a jsfiddle where you tried to change the colors like that and it didn't work?

- Sergey


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

asgallant

unread,
Aug 12, 2013, 11:09:27 AM8/12/13
to google-visua...@googlegroups.com
It looks like your "series" option is listed outside the ChartWrapper's "options" parameter, so if that's where you are trying to set the colors, it definitely won't work.  Try this instead:

ComboChart = new google.visualization.ChartWrapper({
    chartType: "ComboChart",
    containerId: "combochart",
    options: {
        chartArea: {
            height: "80%",
            width: "70%",
        },
        seriesType: "bars",
        isStacked:"True",
        series: {
            0: {  // set the options for the first series (columns)
                type: "bars",
                targetAxisIndex: 0,
                color: 'red'

            },
            1: {  // set the options for the second series (line)
                type: "line",
                targetAxisIndex: 1,
                color: 'maroon'

            },
            2: {  // set the options for the second series (line)
                type: "line",
                targetAxisIndex: 2,
                color: '#338067'

            },
            3: {  // set the options for the second series (line)
                type: "line",
                targetAxisIndex: 3,
                color: '#FC53D2'
            }
        }
    }
});

armon000

unread,
Aug 14, 2013, 9:05:38 AM8/14/13
to google-visua...@googlegroups.com
thanks a loooootttttt  asgallant,
Reply all
Reply to author
Forward
0 new messages