Legend resize
Legend resize
Hi,
When i try to resize a window with a legend in it, and there isnt enough room for the legend to draw completely i get the following error:
"Height must be non-negative"
at System.Windows.Rect.set_Height(Double value)
at Steema.TeeChart.WPF.Legend.ResizeChartRect(Rect& rect)
at Steema.TeeChart.WPF.Chart.DoDrawLegend(Rect& tmp)
at Steema.TeeChart.WPF.Chart.DrawTitlesAndLegend(DrawingContext g, Rect& tmp, Boolean BeforeSeries)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g, Boolean noTools)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.Draw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.OnRender(DrawingContext drawingContext)
Is there a way to remove the rectangle from the legend?
When i try to resize a window with a legend in it, and there isnt enough room for the legend to draw completely i get the following error:
"Height must be non-negative"
at System.Windows.Rect.set_Height(Double value)
at Steema.TeeChart.WPF.Legend.ResizeChartRect(Rect& rect)
at Steema.TeeChart.WPF.Chart.DoDrawLegend(Rect& tmp)
at Steema.TeeChart.WPF.Chart.DrawTitlesAndLegend(DrawingContext g, Rect& tmp, Boolean BeforeSeries)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g, Boolean noTools)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.Draw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.OnRender(DrawingContext drawingContext)
Is there a way to remove the rectangle from the legend?
Re: Legend resize
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend resize
Yes i know, but i want the legend to be visisble. If i set the alignment of the legend to bottom or top i get the set_height error when resizing the window. If i set the alignment to right or left i dont get this error. So there seems to be a problem in the legend onpaint with the height of the rectangle. I Tried to make my own class for the legend and inherit from the legend and override the onpaint, but the chart legend doesnt have a setter.
Re: Legend resize
Hi SPS,
Could you please send us a picture showing the chart just before getting the error? I can reproduce the error but only in a chart as small as the ChartRect has been already disappeared.
Could you please send us a picture showing the chart just before getting the error? I can reproduce the error but only in a chart as small as the ChartRect has been already disappeared.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend resize
Hi,
Yes that is what i get too, when the window is too small for the legend rect it will give the error. The project im working on is a dashboard where multiple small windows can be placed and can contain a chart. So if someone resize one of these windows too small it will give this error.
Yes that is what i get too, when the window is too small for the legend rect it will give the error. The project im working on is a dashboard where multiple small windows can be placed and can contain a chart. So if someone resize one of these windows too small it will give this error.
Re: Legend resize
Hi SPS,
We've just fixed a bug that could solve your problem in NET v2009 but to ensure that to you it would be helpful if you could send us a simple code snipped we can run as-is here to reproduce the problem here.
For example, the fixed problem was reproducible with the following:
We've just fixed a bug that could solve your problem in NET v2009 but to ensure that to you it would be helpful if you could send us a simple code snipped we can run as-is here to reproduce the problem here.
For example, the fixed problem was reproducible with the following:
Code: Select all
tChart1.Aspect.View3D = false;
for (int i = 0; i < 40; i++)
{
tChart1.Series.Add(new Steema.TeeChart.WPF.Styles.Line());
tChart1[i].FillSampleValues();
tChart1[i].Title = "this is a series with a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long name";
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend resize
Here is a sample project that reproduce the error when making the window as small as possible.
- Attachments
-
- sample1.zip
- (11.9 KiB) Downloaded 480 times
Re: Legend resize
Hi SPS,
Are you sure that the project you've attached is reproducing the legend problem? Here it gives me another "Height must be non-negative." error:
Are you sure that the project you've attached is reproducing the legend problem? Here it gives me another "Height must be non-negative." error:
System.ArgumentException was unhandled
Message="Height must be non-negative."
Source="WindowsBase"
StackTrace:
at System.Windows.Rect.set_Height(Double value)
at Steema.TeeChart.WPF.Chart.CalcWallsRect(Rect& r)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g, Boolean noTools)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.Draw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.OnRender(DrawingContext drawingContext)
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend resize
Hi yes, because when removing the legend it works ok
Re: Legend resize
Hi SPS,
Yes, I see in your error message that the legend rectangle is what is crashing for you. But here I can see the walls rectangle crashing in one computer (error posted above) and the title rectangle in another:
In the meanwhile I can only think on removing the legend at OnResize event when the window height is too small.
Yes, I see in your error message that the legend rectangle is what is crashing for you. But here I can see the walls rectangle crashing in one computer (error posted above) and the title rectangle in another:
Anyway I've added this to be revised for next releases (TW16014439).System.ArgumentException was unhandled
Message="Height must be non-negative."
Source="WindowsBase"
StackTrace:
at System.Windows.Rect.set_Height(Double value)
at Steema.TeeChart.WPF.Title.Draw(Graphics3D g, Rect& rect)
at Steema.TeeChart.WPF.Title.DoDraw(Graphics3D g, Rect& rect, Boolean CustomOnly, String Entity)
at Steema.TeeChart.WPF.Chart.DrawTitleFoot(Rect& rect, Boolean CustomOnly)
at Steema.TeeChart.WPF.Chart.DrawTitlesAndLegend(DrawingContext g, Rect& tmp, Boolean BeforeSeries)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g, Boolean noTools)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.Draw(DrawingContext g)
at Steema.TeeChart.WPF.TChart.OnRender(DrawingContext drawingContext)
In the meanwhile I can only think on removing the legend at OnResize event when the window height is too small.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend resize
Is there a way to get the legend height when its visibilty state is set to false ?
Re: Legend resize
Hi SPS,
I'm afraid that's not possible. The legend rectangle information isn't available until it is being drawn.
So you should save the heigh into a variable before hiding it.
I'm afraid that's not possible. The legend rectangle information isn't available until it is being drawn.
So you should save the heigh into a variable before hiding it.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |