cant see last label on bottom axis
cant see last label on bottom axis
In this small demo I try to create a chart with three labels
the last one is not visible .
I only see 2 labels on the x axis label1 and label 2.
this.tChart1.Aspect.View3D = false;
this.tChart1.Axes.Bottom.MinorTicks.Visible = false;
tChart1.Legend.Alignment = LegendAlignments.Bottom;
Series s1 = new Line();
tChart1.Series.Add(s1);
s1.Title = "Series1";
Line s2= new Line();
s2.Title = "Series 2";
tChart1.Series.Add(s2);
for (int i = 0; i < 3;i++ )
{
s2.Add(i * 10, "label" + i.ToString());
s1.Add(i * 20, "label" + i.ToString());
}
any idea why
Thanks.
Also , I noticed that in 3D if the last label name is long then it is cut on the right side.
Actually our problem in our application is that we do have 2D chart with 2 labels , one at x = 0 and one at the end of the x axis , we do see both of them but the second one is cut .
I tried to reproduce this in a standalone application (see above ) but for some reason in 2D I dont even get the last label.
the last one is not visible .
I only see 2 labels on the x axis label1 and label 2.
this.tChart1.Aspect.View3D = false;
this.tChart1.Axes.Bottom.MinorTicks.Visible = false;
tChart1.Legend.Alignment = LegendAlignments.Bottom;
Series s1 = new Line();
tChart1.Series.Add(s1);
s1.Title = "Series1";
Line s2= new Line();
s2.Title = "Series 2";
tChart1.Series.Add(s2);
for (int i = 0; i < 3;i++ )
{
s2.Add(i * 10, "label" + i.ToString());
s1.Add(i * 20, "label" + i.ToString());
}
any idea why
Thanks.
Also , I noticed that in 3D if the last label name is long then it is cut on the right side.
Actually our problem in our application is that we do have 2D chart with 2 labels , one at x = 0 and one at the end of the x axis , we do see both of them but the second one is cut .
I tried to reproduce this in a standalone application (see above ) but for some reason in 2D I dont even get the last label.
Re: cant see last label on bottom axis
Hello rino,
I couldn't reproduce your problem using last maintenance release and your example code, and all labels appears in my chart as you can see in next image: Could you tell us which version of TeeChart are you using?
I couldn't reproduce your problem using last maintenance release and your example code, and all labels appears in my chart as you can see in next image: Could you tell us which version of TeeChart are you using?
Best Regards,
Sandra Pazos / 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: cant see last label on bottom axis
Hi Sandra
Im using version 4.0.2011.2082
But actually , the defect I have in our real application is that the last label is visible but cut at the right side.
in your demo , if you try and make the last label , something longer , for example " very long label 2" , you will see that it will be cut.
This is the defect I am trying to fix.
Im using version 4.0.2011.2082
But actually , the defect I have in our real application is that the last label is visible but cut at the right side.
in your demo , if you try and make the last label , something longer , for example " very long label 2" , you will see that it will be cut.
This is the defect I am trying to fix.
Re: cant see last label on bottom axis
Hi Sandra
I just did a test and noticed that the last label can disappear and appear and it depending on the size of the chart.
I docked the chart in a window and I played with the size of the window.
Sometimes the last label disappears and then it reappears. so its just a matter of what size the chart actually is .
In anycase , when it does appear the last label is cut to the right if its not short ("long label 3") for example.
SO there are two seperate issues.
1. The last label doesnt always show (depends on the exact size , its nothing to do with a minimum size , I can make a window smaller and it can disapppear and suddenly appear a gain during the shrinking)
2. The last label is cut if its long.
I just did a test and noticed that the last label can disappear and appear and it depending on the size of the chart.
I docked the chart in a window and I played with the size of the window.
Sometimes the last label disappears and then it reappears. so its just a matter of what size the chart actually is .
In anycase , when it does appear the last label is cut to the right if its not short ("long label 3") for example.
SO there are two seperate issues.
1. The last label doesnt always show (depends on the exact size , its nothing to do with a minimum size , I can make a window smaller and it can disapppear and suddenly appear a gain during the shrinking)
2. The last label is cut if its long.
Re: cant see last label on bottom axis
Hello rino,
and I have gotten next image:
Could you tell us if your problem appears in previous image? If your problem is it I suggest you change the label angle as do in below lines:
I hope will helps.
Thanks,
I have modified your code:1. The last label doesnt always show (depends on the exact size , its nothing to do with a minimum size , I can make a window smaller and it can disapppear and suddenly appear a gain during the shrinking)
Code: Select all
Steema.TeeChart.Styles.Line series1,series2;
private void InitializeChart()
{
//Chart
tChart1.Dock = DockStyle.Fill;
this.tChart1.Aspect.View3D = false;
this.tChart1.Axes.Bottom.MinorTicks.Visible = false;
tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
//Series
series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
series2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
tChart1.Panel.MarginRight = 10;
series1.Title = "Series1";
series2.Title = "Series2";
for (int i = 0; i < 3; i++)
{
series1.Add(i * 10, "long label 3" + i.ToString());
series2.Add(i * 20, "long label 3" + i.ToString());
}
}
Code: Select all
tChart1.Axes.Bottom.Labels.Angle = 90;
You can try to increase Margin Right of Chart as do in next line of code:2. The last label is cut if its long.
Code: Select all
tChart1.Panel.MarginRight = 10;
Thanks,
Best Regards,
Sandra Pazos / 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: cant see last label on bottom axis
Hi Sandra
I cannot make the angle 90 , becuase we want the graph to remain the same hieght
regarding the margin , the problem is I dont know in advance what the label name will be so I need to resize the margin dynamically , which I am not sure how to do so I can I know how much margin to give.
Dont you consider this a bug ? because I would expect the label to shift to the left if it doesnt fit in .
Thanks
I cannot make the angle 90 , becuase we want the graph to remain the same hieght
regarding the margin , the problem is I dont know in advance what the label name will be so I need to resize the margin dynamically , which I am not sure how to do so I can I know how much margin to give.
Dont you consider this a bug ? because I would expect the label to shift to the left if it doesnt fit in .
Thanks
Re: cant see last label on bottom axis
Hello rino,
I have added your request in wish-list with number[TF02015450] to be considered inclusion it in next maintenance releases of TeeChart.Net.On the other hand, I have made a simple code that you can use as workaround:
Could you tell us, if previous code works as you expected?
I hope will helps.
Thanks,
I have added your request in wish-list with number[TF02015450] to be considered inclusion it in next maintenance releases of TeeChart.Net.On the other hand, I have made a simple code that you can use as workaround:
Code: Select all
Steema.TeeChart.Styles.Line series1, series2;
private void InitializeChart()
{
//Chart
tChart1.Dock = DockStyle.Fill;
this.tChart1.Aspect.View3D = false;
this.tChart1.Axes.Bottom.MinorTicks.Visible = false;
tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
//Series
series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
series2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
//tChart1.Panel.MarginRight = 10;
series1.Title = "Series1";
series2.Title = "Series2";
for (int i = 0; i < 3; i++)
{
series1.Add(i * 10, "long label 3" + i.ToString());
series2.Add(i * 20, "long label 3" + i.ToString());
}
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (series1.Labels[tChart1.Series.Count-1].Length/2 >=tChart1.Panel.MarginRight|| series2.Labels[tChart1.Series.Count-1].Length/2>=tChart1.Panel.MarginRight)
{
tChart1.Panel.MarginRight = series1.Labels[tChart1.Series.Count-1].Length / 2 + tChart1.Panel.MarginRight;
}
}
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / 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: cant see last label on bottom axis
Hi Sandra
thanks for the reply
No , this doesnt work , and I assume that its simply because I dont think there is any connection between Label length and the Margin units
whats the point of measuring the length of the label string , its not the same units as the margin is it. ?
label length represents of characters in the label string , while Margin units i assume is something else
thanks for the reply
No , this doesnt work , and I assume that its simply because I dont think there is any connection between Label length and the Margin units
whats the point of measuring the length of the label string , its not the same units as the margin is it. ?
label length represents of characters in the label string , while Margin units i assume is something else
Re: cant see last label on bottom axis
Hello rino,
You are right. Numbers of characters are not the same units as MarginUnits. I have made, other code that uses width of bottom labels and PanelMarginsUnits as pixels, and this works fine for me.
Could you tell us if previous code works as you want?
I hope will helps.
Thanks,
You are right. Numbers of characters are not the same units as MarginUnits. I have made, other code that uses width of bottom labels and PanelMarginsUnits as pixels, and this works fine for me.
Code: Select all
Steema.TeeChart.Styles.Line series1, series2;
private void InitializeChart()
{
//Chart
tChart1.Dock = DockStyle.Fill;
this.tChart1.Aspect.View3D = false;
this.tChart1.Axes.Bottom.MinorTicks.Visible = false;
tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
//Series
series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
series2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
//tChart1.Panel.MarginRight = 10;
series1.Title = "Series1";
series2.Title = "Series2";
for (int i = 0; i < 3; i++)
{
series1.Add(i * 10, "long label 323253" + i.ToString());
series2.Add(i * 20, "long label 323253" + i.ToString());
}
tChart1.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (tChart1.Axes.Bottom.Labels.Width / 2 >= tChart1.Panel.MarginRight)
{
tChart1.Panel.MarginRight = (tChart1.Axes.Bottom.Labels.Width/2)+tChart1.Panel.MarginRight;
tChart1.Panel.MarginLeft = (tChart1.Axes.Bottom.Labels.Width / 2) + tChart1.Panel.MarginLeft;
}
}
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / 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: cant see last label on bottom axis
Hi Sandra
your last code seems to do the correct calculation however it doesnt have effect the first time.
it only works after a second draw of the chart is done, the changes in afterDraw , do not cause the chart to repaint itself , so only when the chart is drawn again will the changes in the margin have effect.
This should be calculated sometime before the draw is performed,
your last code seems to do the correct calculation however it doesnt have effect the first time.
it only works after a second draw of the chart is done, the changes in afterDraw , do not cause the chart to repaint itself , so only when the chart is drawn again will the changes in the margin have effect.
This should be calculated sometime before the draw is performed,
Re: cant see last label on bottom axis
Hello rino,
In this case, use tChart1.Draw() is necessary, because you must repaint chart if you want sizes have a correct value and you can use it correctly.
Thanks,
In this case, use tChart1.Draw() is necessary, because you must repaint chart if you want sizes have a correct value and you can use it correctly.
Thanks,
Best Regards,
Sandra Pazos / 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: cant see last label on bottom axis
You mean to call Draw from within the AfterDraw event . isnt this a little awkward ?
Also , what is the difference between Draw and Refresh ? which is better.
Also , what is the difference between Draw and Refresh ? which is better.
Re: cant see last label on bottom axis
Hello rino,
Draw Method:
Paints the Chart internally to calculate Chart values that would otherwise be calculated only when the Chart is actually Painted to the screen.
Refresh Method:
Forces the control to invalidate its client area and immediately redraw itself and any child controls.
In your case its better Draw Method so you need the Chart values.
Thanks,
Sorry, I think that I don't explain good. In my code there is a tChart.Draw() in the InititializeChart(), because could repaint chart to achieve the correct values of width of labels shape.You mean to call Draw from within the AfterDraw event . isnt this a little awkward ?
Draw Method:
Paints the Chart internally to calculate Chart values that would otherwise be calculated only when the Chart is actually Painted to the screen.
Refresh Method:
Forces the control to invalidate its client area and immediately redraw itself and any child controls.
In your case its better Draw Method so you need the Chart values.
Thanks,
Best Regards,
Sandra Pazos / 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 |