| Page 1 of 1 | [ 3 posts ] |
|
Hi , I am trying to change the color of the bars in my chart, but this don't seem to be working:
var myChart = new Y.Chart({ type: typeChart, legend: { position: "right", width: 300, height: 300, styles: { hAlign: "center", hSpacing: 4 } }, axes: { category: { keys: [pCategoryKey], type: "category", styles: { label: { rotation: -45 } } } }, categoryKey: pCategoryKey, dataProvider:dataSource, horizontalGridlines: true, verticalGridlines: true, render:renderId }); var colors = ["#41ab5d", "#4eb3d3", "#ef6548"]; var mySeries = myChart.getSeries(0); mySeries._styles.marker.fill.colors = colors; return myChart; I change my series values dynamically so I can't name them before. This don't work either: series:{ styles:{ marker:{ fill:{ colors: ["#41ab5d", "#4eb3d3", "#ef6548"]; } } } }, |
|
I cannot tell from your sample code whether you are trying to style the colors of a chart with 3 series or if you have one series that you want to style with multiple colors. Below are examples of how you could handle either scenario.
This code would set your color array to alternate within a single series: Code: var colors = ["#41ab5d", "#4eb3d3", "#ef6548"]; var mySeries = myChart.getSeries(0); mySeries.set("styles", { marker: { fill: { color: colors } } }); This code would set the fill colors for multiple series: Code: myChart.set("styles", { series: [ { fill: { color: "#41ab5d" } }, { fill: { color: "#4eb3d3" } }, { fill: { color: "#ef6548" } } ]}); Thanks, Tripp |
|
Thanks to you!
I have multiple series so I'm using the second example. Have a nice day! |
| Page 1 of 1 | [ 3 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group