Page 1 of 1
Series marks
Posted: Wed Jan 07, 2009 4:17 am
by 14045174
There are different styles you can choose from for your marks. But here is my puzzle: "Value" and "Label" seem to produce the same marks, so why I would like to use "Label and Value" style? It is just useless. Another observation: "X value" and "X and Y values" work just fine for "normal" series. But if I have horizontal bar, area or line series I again am back to x value duplicated. So for those series, how can I show both coordinates without any custom code and catching any events?
Posted: Wed Jan 07, 2009 10:13 am
by narcis
Hi UserLS,
There are different styles you can choose from for your marks. But here is my puzzle: "Value" and "Label" seem to produce the same marks, so why I would like to use "Label and Value" style? It is just useless.
No, this can be used when you have a string label for each point in the series, for example:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.Marks.Visible = true;
line1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.LabelValue;
Random y = new Random();
for (int i = 0; i < 10; i++)
{
line1.Add(y.Next(), "point " + (i + 1).ToString());
}
}
Another observation: "X value" and "X and Y values" work just fine for "normal" series. But if I have horizontal bar, area or line series I again am back to x value duplicated. So for those series, how can I show both coordinates without any custom code and catching any events?
This is a bug which I have added to the list to be fixed (TF02013685). There's no way of achieving that without using events nor custom code.
An option is doing this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.HorizLine horizLine1 = new Steema.TeeChart.Styles.HorizLine(tChart1.Chart);
horizLine1.Marks.Visible = true;
horizLine1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Label;
horizLine1.FillSampleValues();
for (int i = 0; i < horizLine1.Count; i++)
{
horizLine1.Labels[i] = horizLine1.YValues[i].ToString() + " - " + horizLine1.XValues[i].ToString();
}
}
Another one is customizing marks using the GetSeriesMark event:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.HorizLine horizLine1 = new Steema.TeeChart.Styles.HorizLine(tChart1.Chart);
horizLine1.Marks.Visible = true;
horizLine1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Label;
horizLine1.FillSampleValues();
horizLine1.GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(horizLine1_GetSeriesMark);
}
void horizLine1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
{
e.MarkText = series.YValues[e.ValueIndex].ToString() + " - " + series.XValues[e.ValueIndex].ToString();
}