Hi,
BarChart can be used for presenting 2-dimensional data (where Pie char only
make sense for one dimensional data). The coloring of bars is done
according to column. Therefore, if you want to have the same colors for your
bars, you will need to transpose the table you used for the pie chart. and
have a table with only one row. (The first column of your data table will
become the names of the columns)
Here is a simple example:
var data = new google.visualization.DataTable();
data.addColumn('string', ''); // Leave empty.
data.addColumn('number', 'category 1');
data.addColumn('number', 'category 2');
data.addColumn('number', 'category 3');
data.addRows(1);
data.setValue(0, 1, 10)
data.setValue(0, 2, 20)
data.setValue(0, 3, 30)
On Sun, Jan 9, 2011 at 1:28 PM, andrew <[email protected]> wrote:
> I am displaying data in a PieChart and BarChart side by side. The data
> rows are in two columns, a name and a value. So the PieChart assigns a
> unique color to each row, but the BarChart shows all rows in the same
> color.
>
> I´d like to not have to worry about allocating and assigning colors to
> series myself, as I´m quite happy with the default colors assigned by
> PieChart.
>
> But I´d like to get the array of colors used by the PieChart, and have
> each Bar in the BarChart use the same color as it´s corresponding row-
> value shown in the PieChart - so the user can easily match which row
> value in the Bar corresponds to which value in the Pie.
>
> Is there are way to get the array of colors used by PieChart, so I can
> then manually assign them to the rows in the BarChart?
>
> thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-visualization-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.