Series draw order.
Series draw order.
Hello all,
I have two series, a line and a highlow series to show some bounds.
I want the line series to appear on top of the highlow series, but I want the line series to appear first in the list of series in the editor.
Is there any way in code to make the highlow appear underneath the line series?
Thanks in advance,
Tony.
I have two series, a line and a highlow series to show some bounds.
I want the line series to appear on top of the highlow series, but I want the line series to appear first in the list of series in the editor.
Is there any way in code to make the highlow appear underneath the line series?
Thanks in advance,
Tony.
Re: Series draw order.
Hi Tony,
What you could do is to change the legend text and symbol as you want like in the demos at:
- What's new ?\Welcome !\New in Legend\Items property
- All Features\Welcome !\Miscellaneous\Legend\Symbol OnDraw
Or you could hide the two series from the legend (TChart1.Series(0).ShowInLegend = false) and create two dummy series (series without data) in the order you wish to show them as if they were the "original" series.
What you could do is to change the legend text and symbol as you want like in the demos at:
- What's new ?\Welcome !\New in Legend\Items property
- All Features\Welcome !\Miscellaneous\Legend\Symbol OnDraw
Or you could hide the two series from the legend (TChart1.Series(0).ShowInLegend = false) and create two dummy series (series without data) in the order you wish to show them as if they were the "original" series.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Series draw order.
I've tried changing the drawing order, but as I'm using OnLegendGetText to change the legend entry, things are getting difficult. Hiding series causes all sorts of problems (OnLegendGetText is still called, but if you have hidden series, there is no easy way of working out what series is generating the OnLegendGetText).
I'll continue and see if I can figure a way around the problems.
Tony.
I'll continue and see if I can figure a way around the problems.
Tony.
Re: Series draw order.
Hi Tony,
Here is one of the proposed solutions:
And here the other:
Here is one of the proposed solutions:
Code: Select all
Private Sub Form_Load()
TChart1.AddSeries scArea
TChart1.AddSeries scLine
TChart1.Series(0).Title = "Area Series"
TChart1.Series(1).Title = "Line Series"
TChart1.Series(0).FillSampleValues 25
TChart1.Series(1).FillSampleValues 25
End Sub
Private Sub TChart1_OnGetLegendText(ByVal LegendStyle As Long, ByVal ValueIndex As Long, LegendText As String)
LegendText = TChart1.Series((ValueIndex + 1) Mod (TChart1.SeriesCount)).Title
End Sub
Private Sub TChart1_OnLegendDrawSymbol(ByVal Series As Long, ByVal ValueIndex As Long, ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long)
With TChart1.Canvas
If Series <> -1 Then
.Brush.Color = TChart1.Series((Series + 1) Mod (TChart1.SeriesCount)).Color
.Rectangle Left, Top, Right, Bottom
End If
End With
End Sub
Code: Select all
Private Sub Form_Load()
TChart1.AddSeries scArea
TChart1.AddSeries scLine
TChart1.Series(0).Title = "Area Series"
TChart1.Series(1).Title = "Line Series"
TChart1.Series(0).FillSampleValues 25
TChart1.Series(1).FillSampleValues 25
TChart1.Series(0).ShowInLegend = False
TChart1.Series(1).ShowInLegend = False
TChart1.AddSeries scLine
TChart1.AddSeries scLine
TChart1.Series(2).Title = TChart1.Series(1).Title
TChart1.Series(3).Title = TChart1.Series(0).Title
TChart1.Series(2).Color = TChart1.Series(1).Color
TChart1.Series(3).Color = TChart1.Series(0).Color
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Series draw order.
Things are getting into a right mess when I hide legend entries. On removing a series that had it's legend entry hidden, the legend entry comes back (even though there is no series).
Unfortunately the solutions you propose will only work in very simple graphs. I have a mixture where some plots have "bounds" (hence the use of the hilow series), others will not have bounds displayed.
Unfortunately the solutions you propose will only work in very simple graphs. I have a mixture where some plots have "bounds" (hence the use of the hilow series), others will not have bounds displayed.
Re: Series draw order.
Hi Tony,
Please, send us a simple example project we can run as-is here to reproduce your problem. I understand that your chart needs some features that may conflict with the proposed solutions, but, if we understand what are you exactly doing (or allowing the users to do) we may think on another solution or a variation of the above.
Please, send us a simple example project we can run as-is here to reproduce your problem. I understand that your chart needs some features that may conflict with the proposed solutions, but, if we understand what are you exactly doing (or allowing the users to do) we may think on another solution or a variation of the above.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Series draw order.
I've attached a project.
Click "Command2" followed by "Command3".
Click "Command2" followed by "Command3".
- Attachments
-
- VB98.zip
- (1.83 KiB) Downloaded 619 times
Re: Series draw order.
Hi Tony,
And could you explain how would you expect the application sent to respond?
I can see a known problem with it, related with RemoveSeries method:
http://www.teechart.net/support/viewtop ... 53&start=0
Simplifying your application a little bit, here is what I have:
So, what would you expect to see when the button is pressed?
And could you explain how would you expect the application sent to respond?
I can see a known problem with it, related with RemoveSeries method:
http://www.teechart.net/support/viewtop ... 53&start=0
Simplifying your application a little bit, here is what I have:
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.AddSeries scHighLow
TChart1.AddSeries scLine
TChart1.Series(0).Title = "HiLo Series"
TChart1.Series(1).Title = "Line Series"
TChart1.Series(0).Color = RGB(255, 0, 0)
TChart1.Series(1).Color = RGB(255, 0, 0)
For i = 0 To 100
TChart1.Series(1).AddXY i, i, "", RGB(255, 0, 0)
TChart1.Series(0).asHighLow.AddHighLow i, i * 1.2, i * 0.8, "", RGB(255, 0, 0)
Next i
TChart1.Series(0).asHighLow.Transparency = 60
TChart1.Series(0).asHighLow.HighBrush.Style = bsSolid
TChart1.Series(0).asHighLow.LowBrush.Style = bsSolid
TChart1.Series(0).asHighLow.HighPen.Visible = True
TChart1.Series(0).asHighLow.LowPen.Visible = True
TChart1.Series(0).ShowInLegend = False
TChart1.Series(0).ShowInEditor = False
TChart1.Series(1).ShowInLegend = True
TChart1.Legend.LegendStyle = lsSeries
End Sub
Private Sub TChart1_OnGetLegendText(ByVal LegendStyle As Long, ByVal ValueIndex As Long, LegendText As String)
Select Case ValueIndex
Case 0:
LegendText = "My Series - Bounds"
Case 1:
LegendText = "My Series"
End Select
End Sub
Private Sub Command1_Click()
TChart1.Series(0).Active = False
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Series draw order.
>> And could you explain how would you expect the application sent to respond?
Yes. Click command2 to give the plot and it's bounds. Click command3 to just show the plot, but the legend now has "My series - bounds", "My Series", plus values "2" - "24", only "My Series" should be shown. When I call "TChart1.Legend.LegendStyle = lsSeries" as your suggestion, that seems to remove the numerical values. But should I have to even call that as I didn't change the legend style in the first place?
>> I can see a known problem with it, related with RemoveSeries method:viewtopic.php?f=1&t=10953&start=0
ok.
Any idea when this fix will be available? And in the next update, can you add in the ability to have a legend entry different to series name without having to rely on OnLegendGetText (http://www.teechart.net/support/viewtop ... 2&start=15)? My code is increasingly becoming full of fixes and workarounds because of things like this.
Yes. Click command2 to give the plot and it's bounds. Click command3 to just show the plot, but the legend now has "My series - bounds", "My Series", plus values "2" - "24", only "My Series" should be shown. When I call "TChart1.Legend.LegendStyle = lsSeries" as your suggestion, that seems to remove the numerical values. But should I have to even call that as I didn't change the legend style in the first place?
>> I can see a known problem with it, related with RemoveSeries method:viewtopic.php?f=1&t=10953&start=0
ok.
Any idea when this fix will be available? And in the next update, can you add in the ability to have a legend entry different to series name without having to rely on OnLegendGetText (http://www.teechart.net/support/viewtop ... 2&start=15)? My code is increasingly becoming full of fixes and workarounds because of things like this.
Re: Series draw order.
Hi Tony,
By default LegendStyle is lsAuto. This style works as lsValues (lists all the values in the first visible series) when you have one series active and as lsSeries (lists all the series names) when you have more then one series active. So, when you click command2, you have one series (all its values are going to be shown in the legend) and you change the first two legend rows with the OnGetLegendText event. If you want to always have as many items in the legend as series active, you can force it with:TonyVSUK wrote:Yes. Click command2 to give the plot and it's bounds. Click command3 to just show the plot, but the legend now has "My series - bounds", "My Series", plus values "2" - "24", only "My Series" should be shown. When I call "TChart1.Legend.LegendStyle = lsSeries" as your suggestion, that seems to remove the numerical values. But should I have to even call that as I didn't change the legend style in the first place?
Code: Select all
TChart1.Legend.LegendStyle = lsSeries
I'm afraid I can't tell you a date for this to be implemented. I recommend you to be aware at this forum or subscribe to our RSS news feed for new release announcements and what's implemented on them.TonyVSUK wrote:Any idea when this fix will be available? And in the next update, can you add in the ability to have a legend entry different to series name without having to rely on OnLegendGetText (viewtopic.php?f=1&t=10102&start=15)? My code is increasingly becoming full of fixes and workarounds because of things like this.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Series draw order.
I regularly visit the website. But I've been struggling with OnLegendGetText for nearly a year now, no mention of it being added in the latest release even though you said it was on the list (http://www.teechart.net/support/viewtop ... 2&start=15).Yeray wrote:I'm afraid I can't tell you a date for this to be implemented. I recommend you to be aware at this forum or subscribe to our RSS news feed for new release announcements and what's implemented on them.
Re: Series draw order.
Hi Tony,
Regarding this, please see my reply on the according thread:
http://www.teechart.net/support/viewtop ... =15#p46627
Regarding this, please see my reply on the according thread:
http://www.teechart.net/support/viewtop ... =15#p46627
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |