Page 1 of 1
Customizing Series
Posted: Tue Jan 25, 2005 9:43 am
by 9080952
Hi,
Two questions about customizing series:
1) is it possible that not each data point on my series shows up with a pointer, but let's say each 10th data point; the problem is that I have large series of length of 400, so I only see the pointers and no line; is there some increment for pointers ??
2) normally the data points are connected with straight lines; is it possible to present the series as a collection of points; I can realize that by means of the TeeChart Editor, but how to do that in run time ??
Some help would be nice.
Thanks a lot.
Kind regards,
Antoon Koster
WL| Delft Hydraulics
Netherlands
Posted: Tue Jan 25, 2005 9:56 am
by Marjan
Hi.
Re #1 : Yes, it can be done. You can use series GetPointerStyle event to filter series pointers. Example
Code: Select all
private void line1_GetPointerStyle(Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventArgs e)
{
// Diplay only every 10th pointer
if (e.ValueIndex % 10 != 0) e.Style = Steema.TeeChart.Styles.PointerStyles.Nothing;
else e.Style = Steema.TeeChart.Styles.PointerStyles.Circle;
}
Re #2 : Simply use point series instead of line series. Or hide line series connecting pen by setting lineseries Brush.Visible and LinePen.Visible properties to false:
Code: Select all
line1.Brush.Visible = false;
line1.LinePen.Visible = false;
Posted: Tue Jan 25, 2005 11:38 am
by 9080952
Hi,
Thanks for your quick reply.
I just tried your second example, and tried to hide drawing the lines, by means of
line1.Brush.Visible = false;
line1.LinePen.Visible = false;
but TeeChart still draws the lines in between the data points. Strange ..
The complete code looks like this:
Steema.TeeChart.Styles.Line line;
int iSeries=0;
for (int iPar=0;iPar<noPars;iPar++)
{
for (int iLoc=0;iLoc<noLocs;iLoc++)
{
DateTime[] xValues = new DateTime[noTimes];
float[] yValues = new float[noTimes];
line = new Steema.TeeChart.Styles.Line();
line.CustomVertAxis = customAxis[iPar];
// populating series
line.XValues.DateTime = true;
line.Marks.Visible = marksVisible;
line.Pointer.Visible = pointersVisible;
line.Pointer.Style = pointerStyles[iPar];
line.Pointer.VertSize = 3;
line.Color = lineColors[iSeries];
int iWidth = Math.Max(1,iSeries/this.maxColors+1);
line.LinePen.Width = iWidth;
line.Brush.Visible = false;
line.LinePen.Visible = false;
tChart1.Series.Add(line);
DateTime start = new DateTime();
for (int iTime=0;iTime<noTimes;iTime++)
{
xValues[iTime] = dateTimes[iTime];
yValues[iTime] = gsSeries[iPar,iLoc,iTime];
}
tChart1.Series[iSeries].Add(xValues,yValues);
tChart1.Series[iSeries].Title =
gsParameters[iPar] + gsLocations[iLoc];
tChart1.BackColor = Color.White;
iSeries++;
}
}
noSeries = iSeries;
Any idea what's going wrong ??
Thanks,
Antoon Koster
WL|Delft Hydraulics
Netherlands
Posted: Wed Jan 26, 2005 5:12 pm
by Pep
Hi Antoon,
are you using the latest Build available on our web site (at the private customers download page ) ?
Using the following code works fine here.
Code: Select all
private void Form1_Load(object sender, System.EventArgs e)
{
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line();
line1.FillSampleValues();
line1.Pointer.Visible =true;
line1.LinePen.Visible =false;
line1.Brush.Visible = false;
tChart1.Series.Add(line1);
}
Posted: Mon Jan 31, 2005 8:38 am
by 9080952
Hi,
Thanks for your hints, but I think I am missing some details.
If I change my series from tChart1.Series into
Steema.TeeChart.Styles.CustomPoint series;
then I see a method GetPointerStyle().
Do I have to add an event, like
series.GetPointerStyle += new <event handler> <line1_GetPointerStyle).
Is that the way to do that ?
And last question, how can I connect that custom series to my chart. With *normal* series I use tChart1.Series, but how does that work for custom series.
Thanks a lot.
Anthony,
Wl|Delft Hydraulics
Netherlands
Posted: Thu Feb 10, 2005 6:38 pm
by Pep
Hi Anthony,
yes, you can find one example which shows how to use this event in the Demo Features project included with the installation. Do a search for "pointer style event".