Legend drawn outside plotting area
Legend drawn outside plotting area
In the past we have been setting the legend alignment on our plots to the right of the plot i.e. Legend.Alignment = 1
This worked OK
We recently tried setting the Alignment to the top of the plot i.e. Legend.Alignment = 2
Although the legend does appear at the top of the plot it appears far over to the left so only the right hand part of the legend is visible (the left hand part of the legend is off the plot area).
If I move the mouse over the plot area it will eventually re-center itself correctly on the plot.
I also tried looking at the plot properties dialog and the Legend-Position tab showed no position selected.
Is there another property we need to set to center the legend?
This worked OK
We recently tried setting the Alignment to the top of the plot i.e. Legend.Alignment = 2
Although the legend does appear at the top of the plot it appears far over to the left so only the right hand part of the legend is visible (the left hand part of the legend is off the plot area).
If I move the mouse over the plot area it will eventually re-center itself correctly on the plot.
I also tried looking at the plot properties dialog and the Legend-Position tab showed no position selected.
Is there another property we need to set to center the legend?
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Legend drawn outside plotting area
Hello!
Using the latest public release of TeeChart, the following code:
gives me the following:
Which version of TeeChart are you using? Can you give me a simple code example which reproduces your problem?
Using the latest public release of TeeChart, the following code:
Code: Select all
private void InitializeChart()
{
Line series1 = new Line(tChart1.Chart);
series1.FillSampleValues();
tChart1.Legend.Alignment = LegendAlignments.Top;
}
Best Regards,
Christopher Ireland / 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 |
Re: Legend drawn outside plotting area
Christopher
The version of TeeChart.dll is 4.1.2011.4193.
We use a wrapper but we end up calling the following:-
x_chart.Legend.Visible = true;
x_chart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series;
x_chart.Legend.CheckBoxes = true;
x_chart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Top;
When the plot is first created we get the plot shown in the attachment with the legend too far over to the left.
If you resive the plot or move the mouse over the data then the legend suddenly moves into the center.
Thanks for any assistance.
The version of TeeChart.dll is 4.1.2011.4193.
We use a wrapper but we end up calling the following:-
x_chart.Legend.Visible = true;
x_chart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series;
x_chart.Legend.CheckBoxes = true;
x_chart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Top;
When the plot is first created we get the plot shown in the attachment with the legend too far over to the left.
If you resive the plot or move the mouse over the data then the legend suddenly moves into the center.
Thanks for any assistance.
- Attachments
-
- before.png (96.15 KiB) Viewed 15743 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Legend drawn outside plotting area
Hello -
The oldest version I presently have installed on my machine is 4.1.2013.5280 - running the following code:
gives me:
Would you please be so kind as to run this code in a new WinForm project with just a TChart on the form?
The oldest version I presently have installed on my machine is 4.1.2013.5280 - running the following code:
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
for (int i = 0; i < 3; i++)
{
Line line = new Line(tChart1.Chart);
line.Pointer.Visible = true;
line.FillSampleValues();
line.Title = "Series Title " + i.ToString();
}
tChart1.Legend.Visible = true;
tChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series;
tChart1.Legend.CheckBoxes = true;
tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Top;
}
Would you please be so kind as to run this code in a new WinForm project with just a TChart on the form?
Best Regards,
Christopher Ireland / 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 |
Re: Legend drawn outside plotting area
Christopher
We have several products using TChart in a similar way. And its the same version for all products.
All products use the same calls to setup the legend.
However one product does center the legend correctly whereas another has the legend positioned off the left hand side of the plot (as shown in my last file upload).
So I don't think it is the version.
I had assumed that although we think we are setting up the legend the same in all our products presumably there is something we are doing differently. Or there is something to do with how the chart is embedded in the dialog - maybe relating to resizing.
Can you think of anything that might cause the different behaviour?
We have several products using TChart in a similar way. And its the same version for all products.
All products use the same calls to setup the legend.
However one product does center the legend correctly whereas another has the legend positioned off the left hand side of the plot (as shown in my last file upload).
So I don't think it is the version.
I had assumed that although we think we are setting up the legend the same in all our products presumably there is something we are doing differently. Or there is something to do with how the chart is embedded in the dialog - maybe relating to resizing.
Can you think of anything that might cause the different behaviour?
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Legend drawn outside plotting area
Hello,
Normally we'd ask for a minimal, complete and verifiable example [MCVE] to enable us to reproduce the issue here and fix it. If the code I sent you in my last message does work correctly for a TChart object sitting on a WinForm designer, then in order to obtain a MCVE we'd have to ask you to modify this code so that the problem can be clearly seen. I understand that in your case this may not be as easy as it sounds, but other than getting lucky with a guess at what is happening I can't see any other way forward.
Difficult to say - maybe something is interfering with the timing of the paint order of TChart - are you running it on a separate thread?petex wrote: I had assumed that although we think we are setting up the legend the same in all our products presumably there is something we are doing differently. Or there is something to do with how the chart is embedded in the dialog - maybe relating to resizing.
Can you think of anything that might cause the different behaviour?
Normally we'd ask for a minimal, complete and verifiable example [MCVE] to enable us to reproduce the issue here and fix it. If the code I sent you in my last message does work correctly for a TChart object sitting on a WinForm designer, then in order to obtain a MCVE we'd have to ask you to modify this code so that the problem can be clearly seen. I understand that in your case this may not be as easy as it sounds, but other than getting lucky with a guess at what is happening I can't see any other way forward.
Best Regards,
Christopher Ireland / 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 |
Re: Legend drawn outside plotting area
Christopher
Its not multithreaded so that is not the issue.
Its a huge code base so I doubt it is practical to create a simple program to show the issue.
The plot is embedded in dialog which has other panels so I suspect it may be a sizing issue i.e. the legend is positioned before another panel is introduced which make resizes the plot but not the legend.
I am not a regular user of TChart (I just do occasional bug fixes). So can you tell me if there is a resize call that I could add at the end of the initialisation that might sort out any resizing problems?
Its not multithreaded so that is not the issue.
Its a huge code base so I doubt it is practical to create a simple program to show the issue.
The plot is embedded in dialog which has other panels so I suspect it may be a sizing issue i.e. the legend is positioned before another panel is introduced which make resizes the plot but not the legend.
I am not a regular user of TChart (I just do occasional bug fixes). So can you tell me if there is a resize call that I could add at the end of the initialisation that might sort out any resizing problems?
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Legend drawn outside plotting area
Yes - TChart has a Resize event which it inherits from the Control class from which it derives.petex wrote:So can you tell me if there is a resize call that I could add at the end of the initialisation that might sort out any resizing problems?
Best Regards,
Christopher Ireland / 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 |
Re: Legend drawn outside plotting area
Christopher
Thanks, I will give it a try.
Thanks, I will give it a try.