0

ボックス プロットの場合、チャート エリアに平均値、中央値、標準偏差を表示したい。

問題は、余分な凡例を下の軸の後の空白スペースに配置できないことです。誰かがこれを手伝ってくれますか?

4

1 に答える 1

0

ExtraLegend ツールでカスタム位置を計算する前に、チャートを再描画する必要があるため、問題が発生したと思います。元の凡例に合わせて ExtraLegend ツールを描画した次の簡単なコードで行うのと同様のことを行うことができます。

Private Sub Form_Load()
  TChart1.AddSeries scBox
  TChart1.AddSeries scBox
  TChart1.Series(0).FillSampleValues 5
  TChart1.Series(1).FillSampleValues 5
  TChart1.Legend.LegendStyle = lsValues
  TChart1.Series(0).asBoxPlot.Box.Brush.Color = vbRed
  TChart1.Series(1).asBoxPlot.Box.Brush.Color = vbBlue
  TChart1.Tools.Add tcExtraLegend
  TChart1.Tools.Items(0).asExtraLegend.Series = TChart1.Series(1)
  'Use internal Repaint to calculate the position of Legend.
 TChart1.Environment.InternalRepaint
   With TChart1.Tools.Items(0).asExtraLegend.Legend
    .CustomPosition = True
    .Left = TChart1.Legend.Left
    .Top = TChart1.Legend.ShapeBounds.Bottom + 10
  End With
End Sub

私の提案コードが問題の解決に役立つかどうか教えていただけますか?

役立つことを願っています。

ありがとう、

于 2013-10-01T10:01:28.647 に答える