Changed behavior in legend
Posted: Mon Jun 21, 2010 12:30 pm
Hi,
due to the last discovered problem http://www.teechart.net/support/viewtop ... =4&t=11243 concerning wrong axis scaling I immediately checked the new release (Build 4.0.2010.27963, it was published a few minutes after that posting).
This earlier posting is related to a strange axis scaling and therefore I will not add the new problem to this thread. But there you can see how the legend appears with the old release http://www.teechart.net/support/viewtop ... =4&t=11243
When I now open the same *.ten file (it's contained in the *.zip of the above URL) in my application compiled with the newest release it looks so: The black legend items text disappeared (the white text is due to another bug explained below)
The reason is:
In order to get sub- and superscripts I go the following way:
- creating custom rich text for legend items
- setting the "regular" legend font to color.transparent but the same size as in my "custom" rich text
- drawing the "custom" legend items in a function called from within the TChart.AfterDraw event using "regular" items properties:
And here is the error now: Both X and Y are zero in the application compiled with the new TeeChart release.
You can easiliy check it out:
And another bug becomes visible (the code in Button1_Click is to follow this): The image above was exported as metafile to clipboard:
and then pasted into MS paint.
You can easily see that the "regular" legends font color (which was set to transparent) is not transparent ***.
This error occurs during metafile export since a screen copy (by means of Windows 7 snipping tool) results in this image:
Here the "regular" legend font seems to be really transparent.
Please note: The file extension ".fxy" I use in tradition of the old application which shall be replaced by the new one with TeeChart. But the *.fxy files are native *.ten files with no attempts of extending serialization.
What to do?
Uli
***if you can see it not then your monitor settings may be not appropriate: You could increase the contrast in the image editor in order to see the effect.
due to the last discovered problem http://www.teechart.net/support/viewtop ... =4&t=11243 concerning wrong axis scaling I immediately checked the new release (Build 4.0.2010.27963, it was published a few minutes after that posting).
This earlier posting is related to a strange axis scaling and therefore I will not add the new problem to this thread. But there you can see how the legend appears with the old release http://www.teechart.net/support/viewtop ... =4&t=11243
When I now open the same *.ten file (it's contained in the *.zip of the above URL) in my application compiled with the newest release it looks so: The black legend items text disappeared (the white text is due to another bug explained below)
The reason is:
In order to get sub- and superscripts I go the following way:
- creating custom rich text for legend items
- setting the "regular" legend font to color.transparent but the same size as in my "custom" rich text
- drawing the "custom" legend items in a function called from within the TChart.AfterDraw event using "regular" items properties:
Code: Select all
X = MyChart.Legend.Items(series).Left
Y = MyChart.Legend.Items(series).Top
You can easiliy check it out:
Code: Select all
Dim lineser As Steema.TeeChart.Styles.Line
Dim lineser2 As Steema.TeeChart.Styles.Line
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lineser = New Steema.TeeChart.Styles.Line(TChart1.Chart)
lineser.FillSampleValues()
lineser2 = New Steema.TeeChart.Styles.Line(TChart1.Chart)
lineser2.FillSampleValues()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TChart1.Legend.CustomPosition = True
TChart1.Legend.Color = Color.Transparent
TChart1.Legend.Font.Color = Color.Transparent
TChart1.Export.Image.Metafile.CopyToClipboard()
Dim x As String = TChart1.Legend.Items(0).Left.ToString
MsgBox(x)
End Sub
Private Sub TChart1_AfterDraw(ByVal sender As System.Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D) Handles TChart1.AfterDraw
Dim x As String = TChart1.Legend.Items(0).Left.ToString
MsgBox(x)
End Sub
Code: Select all
ActChildForm.Chart1.Export.Image.Metafile.CopyToClipboard()
You can easily see that the "regular" legends font color (which was set to transparent) is not transparent ***.
This error occurs during metafile export since a screen copy (by means of Windows 7 snipping tool) results in this image:
Here the "regular" legend font seems to be really transparent.
Please note: The file extension ".fxy" I use in tradition of the old application which shall be replaced by the new one with TeeChart. But the *.fxy files are native *.ten files with no attempts of extending serialization.
What to do?
Uli
***if you can see it not then your monitor settings may be not appropriate: You could increase the contrast in the image editor in order to see the effect.