0

Can we plot multiple box polt for single point similar to what we do in bar chart that we have multiple bar at single point.

Thanks Akshay

Yeray
  • 5,009
  • 1
  • 13
  • 25

1 Answers1

0

You can have multiple BoxSeries, something like the example here: http://www.teechart.net/support/viewtopic.php?f=3&t=13048&hilit=boxplot

It's a Delphi example, but it shouldn't be very different in ActiveX.


UPDATE:

From your comments, I understand you want to have some boxes in different X positions, and probably in groups. here it is a simple example of how you could play with the Positions to achieve the same:

Dim nSeries, groupSize As Integer
Private Sub Form_Load()
  Dim i, aIndex, sIndex, lIndex, tmpX As Integer

  TeeCommander1.ChartLink = TChart1.ChartLink
  'TChart1.Header.Text.Text = TChart1.Version

  TChart1.Aspect.View3D = False
  TChart1.Panel.MarginTop = 7
  TChart1.Header.Visible = False
  TChart1.Axis.Bottom.Ticks.Visible = False
  TChart1.Axis.Bottom.MinorTicks.Visible = False

  nSeries = 8
  groupSize = 2

  aIndex = TChart1.Tools.Add(tcAnnotate)
  TChart1.Tools.Items(aIndex).asAnnotation.Text = "group 1"

  tmpX = 0
  For i = 0 To nSeries - 1
    sIndex = TChart1.AddSeries(scBox)
    TChart1.series(sIndex).FillSampleValues
    TChart1.series(sIndex).asBoxPlot.Position = tmpX

    If (i + 1) Mod groupSize Then
      tmpX = tmpX + 1
    Else
      If i + 1 < nSeries - 1 Then
        lIndex = TChart1.Tools.Add(tcColorLine)
        TChart1.Tools.Items(lIndex).asColorLine.Axis = TChart1.Axis.Bottom
        TChart1.Tools.Items(lIndex).asColorLine.Value = tmpX + 1
        tmpX = tmpX + 2

        aIndex = TChart1.Tools.Add(tcAnnotate)
        TChart1.Tools.Items(aIndex).asAnnotation.Text = "group " + Str$(((i + 1) / groupSize) + 1)
      End If
    End If
  Next i

  TChart1.Environment.InternalRepaint
End Sub

Private Sub TChart1_OnAfterDraw()
  Dim tmpX As Integer
  For i = 0 To TChart1.Tools.Count - 1
    If TChart1.Tools.Items(i).ToolType = tcAnnotate Then
      With TChart1.Tools.Items(i).asAnnotation
        If i = TChart1.Tools.Count - 1 Then
          tmpX = TChart1.GetChartRect.Right
        Else
          tmpX = TChart1.Axis.Bottom.CalcXPosValue(TChart1.Tools.Items(i + 1).asColorLine.Value)
        End If

        If i = 0 Then
          tmpX = TChart1.GetChartRect.Left + (tmpX - TChart1.GetChartRect.Left) / 2
        Else
          tmpX = TChart1.Axis.Bottom.CalcXPosValue(TChart1.Tools.Items(i - 1).asColorLine.Value) + (tmpX - TChart1.Axis.Bottom.CalcXPosValue(TChart1.Tools.Items(i - 1).asColorLine.Value)) / 2
        End If

        .Left = tmpX - .Width / 2
      End With
    End If
  Next i
End Sub

Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
  If Axis = 3 Then
    LabelText = " "
  End If
End Sub

enter image description here

Yeray
  • 5,009
  • 1
  • 13
  • 25
  • Hi, I am looking something like [how-to-plot-multiple-box-plots-in-one-plot](http://stackoverflow.com/questions/12427887/how-to-plot-multiple-box-plots-in-one-plot) – Akshay Bhalla Apr 18 '13 at 11:08
  • Have you tried the mentioned? You just have to add several BoxSeries. And some values to each one, of course. – Yeray Apr 18 '13 at 15:26
  • Yeah I tried this by doing this we can add box plot at multiple X- position what I am looking out is to draw box plot sidebyside on a single position on X -axis, similar to Bar chart we can display bars side by side for multiple series. – Akshay Bhalla Apr 19 '13 at 04:38