Hi,
Is it possible to have different background color for different x-axis range? For example, my x-axis is a date & time scale, say from 1-Apr-09 00:00 to 3-Apr-09 23:30'. I want the background to have different shades for time range between 05:00 to 17:00.
Thanks.
Different background color for different x-axis range
Hi pw,
I think that the easiest solution would be using ColorBand tool. Could you take a look at the demo at Welcome !\Tools\Color Band?
Note that you should set them as vertical doinf something like this:
I think that the easiest solution would be using ColorBand tool. Could you take a look at the demo at Welcome !\Tools\Color Band?
Note that you should set them as vertical doinf something like this:
Code: Select all
colorband1.Axis = tChart1.Axes.Bottom;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Different background color for different x-axis range
Hi,
Revisiting an old question I had. What would be the easiest way to setup the ColorBand if I want to have different color backgrounds for weekends?
I'm not sure how I can loop through the x-axis, figure out which is weekend & setup a ColorBand for each weekend.
Please advise. Thanks.
Revisiting an old question I had. What would be the easiest way to setup the ColorBand if I want to have different color backgrounds for weekends?
I'm not sure how I can loop through the x-axis, figure out which is weekend & setup a ColorBand for each weekend.
Please advise. Thanks.
Re: Different background color for different x-axis range
Hi pw,
Here you have a simple example of how you could do it:
Here you have a simple example of how you could do it:
Code: Select all
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Candle candle1 = new Steema.TeeChart.Styles.Candle(tChart1.Chart);
candle1.FillSampleValues(25);
for (int i = 0; i < candle1.Count; i++)
{
if (DateTime.FromOADate(candle1.DateValues[i]).DayOfWeek == DayOfWeek.Saturday)
{
Steema.TeeChart.Tools.ColorBand colorband = new Steema.TeeChart.Tools.ColorBand(tChart1.Chart);
colorband.Start = candle1.DateValues[i];
colorband.End = candle1.DateValues[i] + 1;
colorband.Axis = tChart1.Axes.Bottom;
colorband.Transparency = 50;
colorband.Pen.Visible = false;
}
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Different background color for different x-axis range
Many thanks, Yeray. You've been a great help.