Page 1 of 1

Charts Legend question : Checkbox placement

Posted: Wed Feb 18, 2009 6:26 am
by 13047832
Hi ,

I have a question of the usage of chart's legend.
How to place checkbox afetr the text in the legend ?

Thanks ,
Best regards.

Posted: Wed Feb 18, 2009 9:48 am
by 10050769
Hi Neo,

If you want put checkbox in the legend you could do the following code:

Code: Select all

            tChart1.Legend.CheckBoxes = true;


I hope that my help you serve.

Posted: Wed Feb 18, 2009 10:09 am
by 13047832
Hi , Sandra :

Thank for your reply .

I have already set the property to true .

Could I put the checkbox in different position ?
For example :

If I make the property true , the checkbox is appeared before the text.

What could I do to make the checkbox behind the text ?

Thanks ,
Best Regards.

Posted: Wed Feb 18, 2009 10:50 am
by 10050769
Hi, Neo
Could I put the checkbox in different position ?
At the moment this isn't possible I added on list of Feauter Reports We will consider if you add a new verison of TeeChart .NET


Thanks,

Posted: Sun Feb 22, 2009 10:33 am
by 13047832
Hi Sandra :
I have a sample that the legend of chart is what i want .
But I could not make it by myself that I didn't kwow what properties should be setting.

Thanks ,
Best Regards.

Image

Posted: Sun Feb 22, 2009 10:35 am
by 13047832
Hi Sandra :
I have make an url , you can link to see my sample.

Thanks.
Best Regards.

http://photo.xuite.net/longsha1223/3088952/1.jpg

Posted: Mon Feb 23, 2009 9:48 am
by 10050769
Hi Neo,

You could do a similar code as next exemple:

Event AfterDraw

Code: Select all

private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            
                    System.Drawing.Rectangle legRect = this.tChart1.Legend.ShapeBounds;
                    Steema.TeeChart.Drawing.Graphics3D gr = tChart1.Graphics3D;
                    gr.HorizontalLine(legRect.Left,legRect.Right,legRect.Bottom -50);
                    gr.TextAlign = System.Drawing.StringAlignment.Near;
                    gr.Font.Size = 8;
                    gr.Font.Color = Color.Navy;
                    gr.TextOut(legRect.Left+8,legRect.Bottom -38,"Bar1 = 50");
                    gr.TextOut(legRect.Left+8,legRect.Bottom -26,"Bar2 = 55");
                    gr.TextOut(legRect.Left+ 8, legRect.Bottom -16, "Bar3 = 59");

        }
Event GetLegendPos

Code: Select all

private void tChart1_GetLegendPos(object sender, Steema.TeeChart.GetLegendPosEventArgs e)
        {
                    e.X -= 80;
                    e.XColor -= 80;

        }

Event GetLegendRect

Code: Select all

private void tChart1_GetLegendRect(object sender, Steema.TeeChart.GetLegendRectEventArgs e)
        {
                 e.Rectangle = new Rectangle(e.Rectangle.Left - 80, e.Rectangle.Top,e.Rectangle.Width + 30,e.Rectangle.Height + 60);

        }

As you can see, the code modifies the legend rectangle. So you can set legend as you like. Also you can modify legend checkboxes using this code or similar, it just depends on the position you'd like to plot them.

Posted: Tue Feb 24, 2009 8:57 am
by 13047832
Hi , Sandra :

Could you let me know how the chart work ?

Because I didn't know exactly the foundation of the chart .

For example :
why to use the Graphics3D ?

Thanks.

Best Regards.

Posted: Tue Feb 24, 2009 10:47 am
by 10050769
Hi Neo,
why to use the Graphics3D ?
Well, I relaized that is not necessary the following part of code:

Code: Select all

       Steema.TeeChart.Drawing.Graphics3D gr = tChart1.Graphics3D;
I recommend you delete this, because the code will be more easy to understand and because the event already has the g parameter which can be used for that.
Could you let me know how the chart work
Ok, In your code you have a chart, and this has a canvas. Well simply you draw in chart's canvas.
On this you can draw different things for exemple: line, rectangles, etc. And place the elements where you want.

I also advise that you have a look at the tutorial and demo examples included with TeeChart .Net installer. Specially you can see a simple example for drawing more text in the legend in All Features\Welcome !\Miscellaneous\Legend\Drawing more text. Demo and tutorials can be found at TeeChart's program group.

Thanks,

Posted: Wed Feb 25, 2009 12:43 am
by 13047832
Hi Sandra :

Code: Select all

I recommend you delete this, because the code will be more easy to understand and because the event already has the g parameter which can be used for that
Is it mean the TeeChart v3 has the property to set ?

Where can I found the property ?

Thanks.

Best Regards.

Posted: Wed Feb 25, 2009 9:13 am
by 10050769
Hi Neo,
Is it mean the TeeChart v3 has the property to set ?
Where can I found the property ?
Yes, in the event AfterDraw appears:private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g). This is Graphics3D g that you use in your code ,and is not necessary to add the other Graphics3D because so exist in this event.

See next code:

Code: Select all

        private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            
                    System.Drawing.Rectangle legRect = this.tChart1.Legend.ShapeBounds;
                    g.HorizontalLine(legRect.Left,legRect.Right,legRect.Bottom -60);
                    g.TextAlign = System.Drawing.StringAlignment.Near;
                    g.Font.Size = 8;
                    g.Font.Color = Color.Navy;
                    g.TextOut(legRect.Left+8,legRect.Bottom -58,"Bar1 = "+tChart1[0].MaxYValue().ToString());
                    g.TextOut(legRect.Left+8,legRect.Bottom -48,"Bar3 = "+tChart1[1].MaxYValue().ToString());
                    g.TextOut(legRect.Left+ 8, legRect.Bottom -38, "Bar4 = "+tChart1[2].MaxYValue().ToString());
                    g.TextOut(legRect.Left + 8, legRect.Bottom -28, "Bar5 = "+ tChart1[3].MaxYValue().ToString());

        }
As you can see g parameter do same with gr for first code, for this reason gr is better than delete


Thanks,