teechart .net cf font size and legend
teechart .net cf font size and legend
Hi
I am using TeeChart Pocket version 3.5.3274.30664 for CF 3.5
I have 2 questions:
1. I am trying to draw on the chart surface in AfterDraw event. I need to draw kind of watermark on the chart. My idea was to draw a string using big font. The problem is that the string is drawn but in small font. I wanted to use font size 50 and it doesnt work.
My code is (in the AfterDraw event):
waterMarkFont = new ChartFont(chart.Chart, new Font("Verdana", 50F, FontStyle.Bold));
waterMarkFont.Brush.Color = Color.FromArgb(130, 219, 190);
g.TextOut(waterMarkFont, 100, 200);
2. This is a chart example with legeng on right side:
---------------
CHART AREA ---- SERIES1
CHART AREA ---- SERIES2
---------------
I dont want to show the colored line in the legend. Instead of this I want to have each series name in the legend colored by its color. Is it possible to do? The idea is to save a little bit space on the screen.
Thanks a lot,
Regards
I am using TeeChart Pocket version 3.5.3274.30664 for CF 3.5
I have 2 questions:
1. I am trying to draw on the chart surface in AfterDraw event. I need to draw kind of watermark on the chart. My idea was to draw a string using big font. The problem is that the string is drawn but in small font. I wanted to use font size 50 and it doesnt work.
My code is (in the AfterDraw event):
waterMarkFont = new ChartFont(chart.Chart, new Font("Verdana", 50F, FontStyle.Bold));
waterMarkFont.Brush.Color = Color.FromArgb(130, 219, 190);
g.TextOut(waterMarkFont, 100, 200);
2. This is a chart example with legeng on right side:
---------------
CHART AREA ---- SERIES1
CHART AREA ---- SERIES2
---------------
I dont want to show the colored line in the legend. Instead of this I want to have each series name in the legend colored by its color. Is it possible to do? The idea is to save a little bit space on the screen.
Thanks a lot,
Regards
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Igor,
1. This works fine:
2. Yes, you could try turning off legend symbols:
And implement GetLegendText event like this:
Hope this helps!
1. This works fine:
Code: Select all
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
g.Font.Name = "Verdana";
g.Font.Size = 20;
g.TextOut(10, 20, "hello world!");
}
Code: Select all
tChart1.Legend.Symbol.Visible = false;
Code: Select all
void tChart1_GetLegendText(object sender, GetLegendTextEventArgs e)
{
if (e.Index<tChart1.Series.Count)
{
tChart1.Graphics3D.Font.Color = tChart1[e.Index].Color;
}
}
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
Thanks for your help.
1. This works, but the text is drawn UPON the Line and what I need is to draw it like watermark on the chart surface. I have tryed to do it in BEforeDRaw event but in this case the text is drawn BELOW the Panel...
Do you have any ideas?
2. It eliminates symbols but the legend is colored the same color inspite of that each Line has its own. I have seen in debugger that the Series[index].Color is correct but Graphics3D.Font.Colore ignores it.
The legend is drawn with the first color.
Thanks
Thanks for your help.
1. This works, but the text is drawn UPON the Line and what I need is to draw it like watermark on the chart surface. I have tryed to do it in BEforeDRaw event but in this case the text is drawn BELOW the Panel...
Do you have any ideas?
2. It eliminates symbols but the legend is colored the same color inspite of that each Line has its own. I have seen in debugger that the Series[index].Color is correct but Graphics3D.Font.Colore ignores it.
The legend is drawn with the first color.
Thanks
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Igor,
Yes, you can do it in the BeforeDrawSeries event:1. This works, but the text is drawn UPON the Line and what I need is to draw it like watermark on the chart
surface. I have tryed to do it in BEforeDRaw event but in this case the text is drawn BELOW the Panel...
Do you have any ideas?
Code: Select all
void tChart1_BeforeDrawSeries(object sender, Graphics3D g)
{
g.Font.Name = "Verdana";
g.Font.Size = 20;
g.TextOut(10, 20, "hello world!");
}
It's much easier than I expected because you can use FontSeriesColor property for that:2. It eliminates symbols but the legend is colored the same color inspite of that each Line has its own. I have
seen in debugger that the Series[index].Color is correct but Graphics3D.Font.Colore ignores it.
The legend is drawn with the first color.
Code: Select all
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);
line1.FillSampleValues();
line2.FillSampleValues();
line3.FillSampleValues();
tChart1.Legend.Symbol.Visible = false;
tChart1.Legend.FontSeriesColor = true;
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 |
I mean that if I do it the text is drawn BENEATH the chart and not ON the chart itself...Yes, you can do it in the BeforeDrawSeries event:
Code:
void tChart1_BeforeDrawSeries(object sender, Graphics3D g)
{
g.Font.Name = "Verdana";
g.Font.Size = 20;
g.TextOut(10, 20, "hello world!");
}
I hope I am clear:)
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Igor,
This is TChart's BeforeDrawSeries not general BeforeDraw event. Have you tried if this works fine at your end?
Thanks in advance.
This is TChart's BeforeDrawSeries not general BeforeDraw event. Have you tried if this works fine at your end?
Thanks in advance.
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 |
This is my code:
chart.BeforeDraw += chart_BeforeDraw;
............
void chart_BeforeDraw(object sender, Graphics3D g)
{
g.Font.Name = "Verdana";
g.Font.Size = 20;
g.TextOut(10, 20, "hello world!");
}
The "hello world" is drawn benetah the chart area and when lines are drawn all the chart area is over the text.
I can send a picture if its not clear.
chart.BeforeDraw += chart_BeforeDraw;
............
void chart_BeforeDraw(object sender, Graphics3D g)
{
g.Font.Name = "Verdana";
g.Font.Size = 20;
g.TextOut(10, 20, "hello world!");
}
The "hello world" is drawn benetah the chart area and when lines are drawn all the chart area is over the text.
I can send a picture if its not clear.