I want to set individual colors on a bar chart, but I can't seem to find how. If I convert the bar chart into a pie chart, the chart automatically gets different colors. But it's defaulted to RED on a bar chart.
Can anybody point me in the right direction?
private void seriesHotSpot1_GetHTMLMap(Steema.TeeChart.Tools.SeriesHotspot sender, Steema.TeeChart.Tools.SeriesHotspotEventArgs e)
{
String strDateFrom = txtDate1.Text.ToString();
String strDateTo = txtDate2.Text.ToString();
String strXaxis = Request["xaxis"].ToString();
String strYaxis = Request["yaxis"].ToString();
String strPath = System.Configuration.ConfigurationSettings.AppSettings.Get("Web.Path");
String strLabel = "";
strLabel = e.Series.Labels[e.PointPolygon.ValueIndex];
e.PointPolygon.Title = strLabel;
e.PointPolygon.HREF = strPath + "listview.jsp?Ver=1&Side=Left&X=" + strXaxis + "&Y=" + strYaxis + "&DateFrom=" + strDateFrom + "&DateTo=" + strDateTo + "&Value=" + strLabel;
e.PointPolygon.Attributes = "target='bottomRightFrame'";
switch(e.PointPolygon.ValueIndex)
{
case 0:
//Set Bar color AND legend to BLUE break;
case 1:
//Set Bar color AND legend to RED break;
case 2:
break;
case 3:
break;
case 4:
break;
default:
break;
}
}
Set Individual Colors on Bar Chart...
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Okie,
The easiest way to do that is setting the colorr for each point when populating the series as shown in the snippet below. You'll have to set ColorEach property to true to enable that behaviour:
The easiest way to do that is setting the colorr for each point when populating the series as shown in the snippet below. You'll have to set ColorEach property to true to enable that behaviour:
Code: Select all
WebChart1.Chart.Series[0].ColorEach=true;
WebChart1.Chart.Series[0].Add(3,Color.Blue);
WebChart1.Chart.Series[0].Add(6,Color.Red);
WebChart1.Chart.Series[0].Add(7,Color.Green);
WebChart1.Chart.Series[0].Add(2,Color.Yellow);
WebChart1.Chart.Series[0].Add(4,Color.White);
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |