我们是否可以为单点绘制多个箱线图,类似于我们在条形图中所做的那样,我们在单点有多个条形图。
谢谢阿克谢
您可以有多个 BoxSeries,类似于此处的示例: http ://www.teechart.net/support/viewtopic.php?f=3&t=13048&hilit=boxplot
这是一个 Delphi 示例,但在 ActiveX 中应该没有太大的不同。
更新:
根据您的评论,我了解您希望在不同的 X 位置放置一些框,并且可能分组。这是一个简单的示例,说明如何使用 Positions 来实现相同的效果:
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