Problem in drawing legend
-
- Newbie
- Posts: 57
- Joined: Mon Nov 19, 2007 12:00 am
Problem in drawing legend
Hi,
I have uploaded one file named "3DPlotLegend.bmp".
Problem is explained there only.
-Raed
I have uploaded one file named "3DPlotLegend.bmp".
Problem is explained there only.
-Raed
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Raed,
You can do something as in the What's New?\Welcome !\New in Legend\Legend Items example in the features demo, available at TeeChart's program group.
You could combine with legend's click events for dynamically creating a TextBox for the legend item you want to edit, for example:
Hope this helps!
You can do something as in the What's New?\Welcome !\New in Legend\Legend Items example in the features demo, available at TeeChart's program group.
You could combine with legend's click events for dynamically creating a TextBox for the legend item you want to edit, for example:
Code: Select all
private int index = -1;
private TextBox text1;
void tChart1_MouseDoubleClick(object sender, MouseEventArgs e)
{
int index = tChart1.Legend.Clicked(e.X, e.Y);
if (index!=-1)
{
text1 = new TextBox();
tChart1.Controls.Add(text1);
text1.Location = new System.Drawing.Point(e.X, e.Y);
text1.Name = "text1";
text1.Size = new System.Drawing.Size(100, 20);
text1.TextChanged += new EventHandler(text1_TextChanged);
}
}
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 |
-
- Newbie
- Posts: 57
- Joined: Mon Nov 19, 2007 12:00 am
Hi,
I have only one suface added in my code. For showing all the labels on the legend, what exactly I have to do?
If you see the uploded image file. The legend is having so many things like flag symbols, edit box.
I am unable to get the clear picture by your solution. It needs more information.
Thanks,
Sanyog
I have only one suface added in my code. For showing all the labels on the legend, what exactly I have to do?
If you see the uploded image file. The legend is having so many things like flag symbols, edit box.
I am unable to get the clear picture by your solution. It needs more information.
Thanks,
Sanyog
-
- Newbie
- Posts: 57
- Joined: Mon Nov 19, 2007 12:00 am
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello,
All Features\Welcome !\Miscellaneous\Legend\OnDrawSymbol Event
To change the text of an existing legend item, see the Features demo under:
What's New?\Welcome !\New in Legend\Legend Items
Narcís' code shows you how to add edit boxes to a legend to change its text.
To add custom symbols to a Legend, see the Features demo under:drillright40 wrote:Please reply for a previous mail.
All Features\Welcome !\Miscellaneous\Legend\OnDrawSymbol Event
To change the text of an existing legend item, see the Features demo under:
What's New?\Welcome !\New in Legend\Legend Items
Narcís' code shows you how to add edit boxes to a legend to change its text.
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
-
- Newbie
- Posts: 57
- Joined: Mon Nov 19, 2007 12:00 am
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello,
Of course, you don't have to inherit from TeeBase. You could use reflector to study teechart's Legend class and use that as inspiration.
Of course you can. You could start with something like this:drillright40 wrote:Cann't we create a custom legend? If yes, how?
Code: Select all
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
InitializeChart();
}
private TChart tChart1;
private MyLegend myLegend;
private void InitializeChart()
{
tChart1 = new TChart();
tChart1.Dock = DockStyle.Fill;
this.Controls.Add(tChart1);
myLegend = new MyLegend(tChart1.Chart);
tChart1.AfterDraw+=new PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Series.Add(typeof(Line));
tChart1[0].FillSampleValues();
tChart1.Legend.Visible = false;
tChart1.Panel.MarginRight = 40;
}
void tChart1_AfterDraw(object sender, Graphics3D g)
{
myLegend.Draw(g, Utils.FromLTRB(tChart1.Width - 200, 100, tChart1.Width - 50, 250));
}
}
public class MyLegend : TeeBase
{
public MyLegend() : this((Chart)null) { }
public MyLegend(Chart c) : base(c) { }
public void Draw(Graphics3D g, Rectangle r)
{
g.Pen.Color = Color.Green;
g.Brush.Color = Color.Red;
g.Rectangle(r);
g.Font.Bold = true;
g.TextOut(r.X, r.Y, base.Chart[0].Title);
}
}
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
-
- Newbie
- Posts: 57
- Joined: Mon Nov 19, 2007 12:00 am
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello,
Short of actually writing your code for you, I can't think of what more I can do to help you.
I have already pointed to you several examples in the feature demo which having seen images of what you are trying to achieve, I thought were relevant. What is more, I've just shown you how you can draw your own legend with with whatever you want in it.drillright40 wrote: Can you suggest me the approach or solution?
Short of actually writing your code for you, I can't think of what more I can do to help you.
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/