You will have to create a separate series for each of your legend entries. However, that's not all of it. You will also have to make the chart stacked (so that the bars take up the full width of the bar group) and set all other values to null. It would look something like this (I removed the style role for readability):
var data = google.visualization.arrayToDataTable([ ['Element', 'Copper', 'Silver', 'Gold', 'Platinum'], ['Copper', 8.94, null, null, null], ['Silver', null, 10.49, null, null], ['Gold', null, null, 19.30, null], ['Platinum', null, null, null, 21.45] ]); On Wed Sep 03 2014 at 4:49:57 AM lakshmi lakkaraju < [email protected]> wrote: > Hi Team, > > I am working on column charts and have a query on the legend. > > var data = google.visualization.arrayToDataTable([ > ['Element', 'Density', *{ role: 'style' }*], > ['Copper', 8.94, *'#b87333'*], // RGB value > ['Silver', 10.49, *'silver'*], // English color name > ['Gold', 19.30, *'gold'*], > ['Platinum', 21.45, *'color: #e5e4e2'* ], // CSS-style declaration > ]); > > Here, the legend displays 1 item with the name Density. > > I want to customize the legend to display the label of the Element with the > respective colors used in the row. > So, the legend has to be : > Copper > Silver > Gold > Platinum with > > > How can I achieve this. > > Thanks, > Lakshmi > > -- > 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 [email protected]. > To post to this group, send email to > [email protected]. > Visit this group at > http://groups.google.com/group/google-visualization-api. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/d/optout.
