Hi,
is it possible to change the text format of a markstip tool? For example there is an "Label and Value" style which show something like that "28.01.2009 5" but i want to show in multiline:
"Date: 28.01.2009
Value: 5"
A custom style would be intresting in that case. For example: "Date: %XValue \nValue: %YValue".
Thanks in advance.
Customizing MarksTip Tool
Customizing MarksTip Tool
Last edited by AIS on Wed Jan 28, 2009 11:09 am, edited 1 time in total.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi AIS,
Yes, you can do that using MarksTip's GetText event, for example:
Yes, you can do that using MarksTip's GetText event, 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.FillSampleValues();
line1.XValues.DateTime = true;
Steema.TeeChart.Tools.MarksTip marksTip1 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
marksTip1.Style = Steema.TeeChart.Styles.MarksStyles.XY;
marksTip1.GetText += new Steema.TeeChart.Tools.MarksTipGetTextEventHandler(marksTip1_GetText);
}
void marksTip1_GetText(Steema.TeeChart.Tools.MarksTip sender, Steema.TeeChart.Tools.MarksTipGetTextEventArgs e)
{
int tmp = e.Text.IndexOf(" ");
e.Text = "Date: " + e.Text.Substring(0, tmp) + "\n" +
"Value: " + e.Text.Substring(tmp + 1);
}
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi AIS,
In that case you can do this:
In that case you can do this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
line1.XValues.DateTime = true;
Steema.TeeChart.Styles.Line line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line2.FillSampleValues();
line2.XValues.DateTime = true;
Steema.TeeChart.Tools.MarksTip marksTip1 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
marksTip1.Style = Steema.TeeChart.Styles.MarksStyles.XY;
marksTip1.GetText += new Steema.TeeChart.Tools.MarksTipGetTextEventHandler(marksTip1_GetText);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
}
private int SeriesIndex = -1;
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
for (int i = 0; i < tChart1.Series.Count; i++)
{
if (tChart1[0].Clicked(e.X,e.Y) != 0)
{
SeriesIndex = i;
break;
}
SeriesIndex = -1;
}
}
void marksTip1_GetText(Steema.TeeChart.Tools.MarksTip sender, Steema.TeeChart.Tools.MarksTipGetTextEventArgs e)
{
int tmp = e.Text.IndexOf(" ");
e.Text = "SeriesName: " + tChart1[SeriesIndex].Title + "\n" +
"Value: " + e.Text.Substring(tmp + 1);
}
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 |
Hi Narcís,
a little correction of your code:
This solution works, but it is a little bit flickering :-/
Thanks anyway
a little correction of your code:
Code: Select all
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
for (int i = 0; i < tChart1.Series.Count; i++)
{
if (tChart1[i].Clicked(e.X, e.Y) != -1)
{
SeriesIndex = i;
break;
}
SeriesIndex = -1;
}
}
void marksTip1_GetText(Steema.TeeChart.Tools.MarksTip sender, Steema.TeeChart.Tools.MarksTipGetTextEventArgs e)
{
if (SeriesIndex > -1)
{
int tmp = e.Text.IndexOf(" ");
e.Text = "SeriesName: " + tChart1[SeriesIndex].Title + "\n" +
"Value: " + e.Text.Substring(tmp + 1);
}
}
Thanks anyway