MultiSeries and MultiLevel Chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Sofia Moraes
Newbie
Newbie
Posts: 4
Joined: Fri Dec 28, 2018 12:00 am

MultiSeries and MultiLevel Chart

Post by Sofia Moraes » Tue Jan 22, 2019 3:56 pm

Hello,

I am building a chart that has 2 series (1 bar and 1 point) and multilevels and can not find a way to fix 2 issues:
1 - as you can see clearly at first chart, the header is bumping with the chart area. I would like to reduce the chart area to avoid it.
2 - at 2nd chart I would like to centralize the points withing each header
Sem título.png
Sem título.png (28.37 KiB) Viewed 8179 times
This is the code where I configure the series:
Dim myBar As Steema.TeeChart.Styles.Bar = New Styles.Bar(myChart.Chart)
Dim myPoint As Steema.TeeChart.Styles.Points = New Styles.Points(myChart.Chart)
myBar.Clear()
myPoint.Clear()

For i = 0 To lsInd.Count - 1
If nNrInfo = 2 Then
myBar.Add(Convert.ToDouble(lsInd(i)(1)), v_corSubTitForm)
End If
myPoint.Add(lsInd(i)(0), If(lsInd(i)(0) < 35, Color.Red, If(lsInd(i)(0) > 75, Color.Green, Color.Yellow)))
Next

myBar.MultiBar = MultiBars.None
myBar.Legend.Visible = False
myBar.HorizAxis = HorizontalAxis.Bottom
myBar.VertAxis = VerticalAxis.Right
myBar.Marks.Visible = True
myBar.MarksOnBar = True
myBar.Marks.TailStyle = MarksTail.None
myBar.Chart.Axes.Right.Title.Text = "Nr. de Fêmeas"
myBar.Chart.Axes.Right.Automatic = True
myBar.Chart.Axes.Bottom.Labels.Visible = False
myBar.Chart.Axes.Right.Grid.Color = Color.Transparent
myBar.SideMargins = True


myPoint.HorizAxis = HorizontalAxis.Bottom
myPoint.Legend.Visible = False
myPoint.VertAxis = VerticalAxis.Left

myPoint.Marks.Visible = True
myPoint.Marks.Font.Size = 16
myPoint.Marks.Transparent = True
myPoint.Marks.ArrowLength = -myPoint.Marks.Font.Size
myPoint.Marks.Arrow.Visible = False

myPoint.Marks.Visible = True
myPoint.Marks.ShapeStyle = Drawing.TextShapeStyle.RoundRectangle
myPoint.ColorEach = False
myPoint.Marks.Color = Color.Transparent
myPoint.Marks.TailStyle = MarksTail.WithPointer
myPoint.Marks.Font.Size = 7

myPoint.Chart.Axes.Left.Title.Text = "Taxa de Concepção"
myPoint.Chart.Axes.Left.Automatic = False
myPoint.Chart.Axes.Left.Minimum = 0
myPoint.Chart.Axes.Left.Maximum = 100
myPoint.Chart.Axes.Left.Increment = 10
myPoint.Chart.Axes.Bottom.Labels.Visible = False

And this is the "Afterdraw" procedure (to draw the header) (this procedure is from Steema Example):

If (myChart.Series.Count > 0) Then

g.Pen.Color = Color.DarkGray

Dim vertgrid As New List(Of Integer)
vertgrid.AddRange(ggfGetSecoesVerticais())
Dim topRowCount As Integer = ggfGetSecoesHorizontais() + 1

Dim hasMeses As Boolean = (vertgrid(0) > 2)
Dim hasCats As Boolean = (vertgrid(1) > 2)
Dim hasDivs As Boolean = (vertgrid(2) > 2)

Dim catCount As Integer = vertgrid(0) * vertgrid(1)
Dim divCount As Integer = vertgrid(0) * vertgrid(1) * vertgrid(2)

'Dim chartTop As Integer = myChart.Axes.Left.IStartPos + 8 ' //some separation
Dim chartTop As Integer = myChart.Axes.Left.IStartPos + 5 ' //some separation

myChart.Axes.Left.IStartPos = chartTop + 80
'myChart.Chart.Axes.Right.IStartPos = myChart.Chart.Axes.Right.IStartPos + 80


Dim chartLeft As Integer = myChart.Axes.Left.Position '+ 15
Dim chartBottom As Integer = myChart.Axes.Bottom.Position
Dim chartRight As Integer = 0

'Top Grid Zone
If (myChart.Axes.Custom.Count = 0) Then
chartRight = myChart.Axes.Bottom.IEndPos
Else
chartRight = lastHorizAxis.IEndPos
End If

For i As Integer = 0 To topRowCount - 1
g.Line(chartLeft, chartTop - (15 * i), chartRight, chartTop - (15 * i))

If (hasDivs And (i = 0)) Then
'ggpImpTopGrid(g, chartTop, chartLeft, chartRight, chartTop - (15 * i), 15, 2, divCount, "div", vertgrid(2))
ggpImpTopGrid(g, chartTop, chartLeft, chartRight, chartTop - (15 * i), 15, 2, divCount, lsN3_2, vertgrid(2))
End If

If ((hasDivs = False And hasCats And (i = 0)) Or (hasDivs And hasCats And (i = 1))) Then
'ggpImpTopGrid(g, chartTop, chartLeft, chartRight, chartTop - (15 * i), 15, 2, catCount, "cat", vertgrid(1))
ggpImpTopGrid(g, chartTop, chartLeft, chartRight, chartTop - (15 * i), 15, 2, catCount, lsN2_2, vertgrid(1))
End If

If ((hasDivs = False And hasCats = False And (i = 0)) Or (hasDivs And hasCats = False And (i = 1)) Or (hasDivs = False And hasCats And (i = 1)) Or (hasDivs And hasCats And hasDivs And (i = 2))) Then
'ggpImpTopGrid(g, chartTop, chartLeft, chartRight, chartTop - (15 * i), 15, 2, vertgrid(0), "month", vertgrid(0))
ggpImpTopGrid(g, chartTop, chartLeft, chartRight, chartTop - (15 * i), 15, 2, vertgrid(0), lsN1, vertgrid(0))
End If
Next

Thanks for help

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: MultiSeries and MultiLevel Chart

Post by Christopher » Thu Jan 24, 2019 7:59 am

Hello!

I'm afraid I can't run your code as there are method definitions that are missing (e.g. ggfGetSecoesVerticais()) - could you please try to produce a Minimal, Complete, and Verifiable example (as defined here) with which I can reproduce your issue here?

I also note that you have not provided code for the second of your two issues.

We are very willing to help, and in our experience it is always more easier to do so when we can reliably reproduce our clients problems here on our machines!
Best Regards,
Christopher Ireland / 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

Post Reply