Page 1 of 1
Method Legend.Inverted=True does not work.
Posted: Mon Jun 21, 2010 10:01 am
by 15654849
Steps to reproduce:
Code: Select all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim errorSeriesH As Styles.Error
Dim errorSeriesL As Styles.Error
With TChart1
.Aspect.View3D = False
errorSeriesH = DirectCast(.Series.Add(New Styles.Error(.Chart)), Styles.Error)
errorSeriesL = DirectCast(.Series.Add(New Styles.Error(.Chart)), Styles.Error)
errorSeriesH.ErrorStyle = Styles.ErrorStyles.Top
errorSeriesL.ErrorStyle = Styles.ErrorStyles.Bottom
.Axes.Left.Automatic = False
.Axes.Left.Maximum = 6
.Axes.Left.Minimum = -6
End With
errorSeriesH.Add(1, 2, CorrectErrorValue(2, 0.2))
errorSeriesH.Add(2, 3, CorrectErrorValue(3, 1))
errorSeriesH.Add(3, -2, CorrectErrorValue(-2, 0.2))
errorSeriesH.Add(4, -3, CorrectErrorValue(-3, -1))
errorSeriesL.Add(5, 2, CorrectErrorValue(2, 0.2))
errorSeriesL.Add(6, 3, CorrectErrorValue(3, 1))
errorSeriesL.Add(7, -2, CorrectErrorValue(-2, 0.2))
errorSeriesL.Add(8, -3, CorrectErrorValue(-3, -1))
[b]TChart1.Legend.Inverted = True[/b] ' this causes the error
End Sub
Result:
see attached image
Re: Method Legend.Inverted=True does not work.
Posted: Mon Jun 21, 2010 10:15 am
by 15654849
You'll need this method aswell to be able to run the sample code
Code: Select all
Private Shared Function CorrectErrorValue(ByVal y As Double, ByVal err As Double) As Double
If y > 0 Then
Return err
Else
Return System.Math.Abs(err) * -1 + y
End If
End Function
Re: Method Legend.Inverted=True does not work.
Posted: Wed Jun 23, 2010 7:44 am
by narcis
Hi CitoICT,
Code below works fine for me here using latest TeeChart for .NET 2010 release available as you can see here:
- InvertedLegend.png (8.04 KiB) Viewed 5505 times
Which TeeChart version are you using? Can you please try using latest release published this week?
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Error errorSeriesH = new Steema.TeeChart.Styles.Error(tChart1.Chart);
Steema.TeeChart.Styles.Error errorSeriesL = new Steema.TeeChart.Styles.Error(tChart1.Chart);
errorSeriesH.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Top;
errorSeriesL.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Bottom;
tChart1.Axes.Left.SetMinMax(-6, 6);
errorSeriesH.Add(1, 2, CorrectErrorValue(2, 0.2));
errorSeriesH.Add(2, 3, CorrectErrorValue(3, 1));
errorSeriesH.Add(3, -2, CorrectErrorValue(-2, 0.2));
errorSeriesH.Add(4, -3, CorrectErrorValue(-3, -1));
errorSeriesL.Add(5, 2, CorrectErrorValue(2, 0.2));
errorSeriesL.Add(6, 3, CorrectErrorValue(3, 1));
errorSeriesL.Add(7, -2, CorrectErrorValue(-2, 0.2));
errorSeriesL.Add(8, -3, CorrectErrorValue(-3, -1));
tChart1.Legend.Inverted = true;
}
private static double CorrectErrorValue(double y, double err)
{
return (y > 0) ? err : System.Math.Abs(err) * -1 + y;
}
Thanks in advance.
Re: Method Legend.Inverted=True does not work.
Posted: Mon Jun 28, 2010 10:40 am
by 15654849
The problem still exists in version 4.0.2010.27961 [24-jun-2010]
Re: Method Legend.Inverted=True does not work.
Posted: Mon Jun 28, 2010 10:42 am
by 15654849
This is the version for Visual Studio 2005, i guess you tried it with the Visual Studio 2010 version of Teechart.
Re: Method Legend.Inverted=True does not work.
Posted: Mon Jun 28, 2010 11:58 am
by 10050769
Hello CitoICT,
I have tested again code that posted Narcis in this thread with last version of TeeChart.Net and Visual Studios 2005 and I think that it needs a TChart1.Draw(), because code works fine with VS2005
Could you check that next code now works as you want?
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Error errorSeriesH = new Steema.TeeChart.Styles.Error(tChart1.Chart);
Steema.TeeChart.Styles.Error errorSeriesL = new Steema.TeeChart.Styles.Error(tChart1.Chart);
errorSeriesH.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Top;
errorSeriesL.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Bottom;
tChart1.Axes.Left.SetMinMax(-6, 6);
errorSeriesH.Add(1, 2, CorrectErrorValue(2, 0.2));
errorSeriesH.Add(2, 3, CorrectErrorValue(3, 1));
errorSeriesH.Add(3, -2, CorrectErrorValue(-2, 0.2));
errorSeriesH.Add(4, -3, CorrectErrorValue(-3, -1));
errorSeriesL.Add(5, 2, CorrectErrorValue(2, 0.2));
errorSeriesL.Add(6, 3, CorrectErrorValue(3, 1));
errorSeriesL.Add(7, -2, CorrectErrorValue(-2, 0.2));
errorSeriesL.Add(8, -3, CorrectErrorValue(-3, -1));
tChart1.Legend.Inverted = true;
tChart1.Draw();
}
private static double CorrectErrorValue(double y, double err)
{
return (y > 0) ? err : System.Math.Abs(err) * -1 + y;
}
I hope will helps.
Thanks,
Re: Method Legend.Inverted=True does not work.
Posted: Tue Jun 29, 2010 8:31 am
by 15654849
Your suggested solution does not work for us:
Code: Select all
tChart1.Legend.Inverted = true;
tChart1.Draw();
However putting the .Draw
before the .Inverted does work.
Code: Select all
tChart1.Draw();
tChart1.Legend.Inverted = true;