I have a chart that displays a series of points where the bottom axis displays datetime values for the series. Points for weekends and holidays are not added, yet, they are displayed on the chart. I've tried a number of ways to turn off these points (TreatNulls=Skip, ExactDateTime=False, etc.) but have been unable to make the chart not display points, or labels, for the missing dates.
How can I get the chart to only display points for dates in the series?
Thanks in advance for any advice.
How not to show missing points
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi glitch,
You should do something as in the All Features\Welcome !\Chart styles\Financial\Candle (OHLC)\Axis Labels no Weekends example at the features demo available at TeeChart's program group.
Hope this helps!
You should do something as in the All Features\Welcome !\Chart styles\Financial\Candle (OHLC)\Axis Labels no Weekends example at the features demo available at TeeChart's program group.
Hope this helps!
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 |
Thank you, Narcís.
I tried setting XValues.DateTime = false; for the areas and lines displayed on the chart, as found in the example, but still get weekends allocated in the chart.
//this code apears in InitializeComponent()
private Steema.TeeChart.Styles.Area area1;
private Steema.TeeChart.Styles.Area area2;
private Steema.TeeChart.Styles.Line line1;
private Steema.TeeChart.Styles.Line line2;
private Steema.TeeChart.Styles.Line line3;
//this code is in the constructor before adding the data points
area1.XValues.DateTime = false;
area2.XValues.DateTime = false;
line1.XValues.DateTime = false;
line2.XValues.DateTime = false;
line3.XValues.DateTime = false;
I see a number of differences between the example and what I am trying to do:
1. The example uses a candle style; I have 2 area and 3 line styles.
2. The example uses a small data set; I have a rather large data set.
3. The example programmatically creates labels; because of the amount of the data I allow chart.Axes.Bottom.Automatic = true.
Am I missing something in the example that would fix this issue?
Do I need to add logic to set the labels in order for this to work?
If I do change the labels, won't the space for the weekends still be allocated on the chart for those days?
Do I need to set chart.Axes.Bottom.Automatic = false and handle that logic as well?
What I need is a way to conceptually not only TreatNulls = DoNotPaint but also eliminate them entirely from the chart so that Friday's data butts up to Monday's.
Thanks.
I tried setting XValues.DateTime = false; for the areas and lines displayed on the chart, as found in the example, but still get weekends allocated in the chart.
//this code apears in InitializeComponent()
private Steema.TeeChart.Styles.Area area1;
private Steema.TeeChart.Styles.Area area2;
private Steema.TeeChart.Styles.Line line1;
private Steema.TeeChart.Styles.Line line2;
private Steema.TeeChart.Styles.Line line3;
//this code is in the constructor before adding the data points
area1.XValues.DateTime = false;
area2.XValues.DateTime = false;
line1.XValues.DateTime = false;
line2.XValues.DateTime = false;
line3.XValues.DateTime = false;
I see a number of differences between the example and what I am trying to do:
1. The example uses a candle style; I have 2 area and 3 line styles.
2. The example uses a small data set; I have a rather large data set.
3. The example programmatically creates labels; because of the amount of the data I allow chart.Axes.Bottom.Automatic = true.
Am I missing something in the example that would fix this issue?
Do I need to add logic to set the labels in order for this to work?
If I do change the labels, won't the space for the weekends still be allocated on the chart for those days?
Do I need to set chart.Axes.Bottom.Automatic = false and handle that logic as well?
What I need is a way to conceptually not only TreatNulls = DoNotPaint but also eliminate them entirely from the chart so that Friday's data butts up to Monday's.
Thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi glitch,
Thanks for the information. In that case I still think same principle can be applied. Can you please try running the example below and check if it's something like what you are looking for?
Thanks in advance.
Thanks for the information. In that case I still think same principle can be applied. Can you please try running the example below and check if it's something like what you are looking for?
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Axes.Bottom.Labels.Angle = 90;
Steema.TeeChart.Styles.Area area1 = new Steema.TeeChart.Styles.Area(tChart1.Chart);
Steema.TeeChart.Styles.Area area2 = new Steema.TeeChart.Styles.Area(tChart1.Chart);
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
Steema.TeeChart.Styles.Line line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
Steema.TeeChart.Styles.Line line3 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
DateTime startDate = DateTime.Now;
Random y = new Random();
for (int i = 0; i < tChart1.Series.Count; i++)
{
tChart1[i].XValues.DateTime = false;
int count = 0;
for (int j = 0; j < 1000; j++)
{
DateTime tmpDate = startDate.AddDays(j);
if (tmpDate.DayOfWeek != DayOfWeek.Saturday & tmpDate.DayOfWeek != DayOfWeek.Sunday)
{
tChart1[i].Add(count, y.Next(), tmpDate.ToString());
count++;
}
}
}
}
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 |
Thank you, again, Narcís.
Now I get it. I was using the following line to load the series.
area1.Add(value.Date, value);
When I changed it to the this, the gaps went away, as in the example.
area1.Add(i, value, value.Date.ToString());
I still need to clean up the marks and labels for this but I haven't seen any other issues this presents.
Thank you for your help.
Now I get it. I was using the following line to load the series.
area1.Add(value.Date, value);
When I changed it to the this, the gaps went away, as in the example.
area1.Add(i, value, value.Date.ToString());
I still need to clean up the marks and labels for this but I haven't seen any other issues this presents.
Thank you for your help.