2016-09-14 86 views
0

我使用圖例中的圖例滾動條工具來顯示圖例框的滾動條。現在水平滾動條在底部位置可見,但我正在尋找一種方法來顯示圖例框的垂直滾動條,在某些情況下可能包含超過50個圖例項目。圖例框垂直滾動條

在此先感謝。

回答

1

不幸的是,圖例滾動條總是被繪製在與圖例對齊相同的位置。但是,在圖例對齊到底部並且包含使用屬性MaxNumRow的很多圖例項目的情況下,您可以防止出現可能的問題。下面的代碼顯示瞭如何能做到這一點

public Form1() 
     { 
      InitializeComponent(); 
      InitializeChart(); 
     } 
     private void InitializeChart() 
     { 
      tChart1.Aspect.View3D = false; 
      tChart1.Dock = DockStyle.Fill; 
      Steema.TeeChart.Tools.LegendScrollBar sclenged = new Steema.TeeChart.Tools.LegendScrollBar(tChart1.Chart); 
      for (int i=0; i<50; i++) 
      { 
       new Steema.TeeChart.Styles.FastLine(tChart1.Chart); 
       tChart1[i].FillSampleValues(10); 
      } 

      tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom; 
      tChart1.Legend.MaxNumRows = 3; 
     } 

希望這可以幫助您提前

問候

感謝

1

正如桑德拉所述,於TeeChart聯想則以滾動條在底部圖例水平,當對齊圖表的頂部或底部時,在右側垂直,當對齊到左側或右側時。因此,垂直滾動的選項是將圖例放置在圖表的右側。

如果你喜歡傳奇在底部,你特別需要一個垂直滾動條,您可以通過自定義設置的傳奇位置和尺寸覆蓋滾動條的位置。請注意,在覆蓋位置時,滾動條水平或垂直行爲仍將遵循圖例的原始上/下或左/右對齊。因此,對於聯想要實現,你可以做這樣的事情:

tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Right; 
    tChart1.Legend.CustomPosition = true; //Chart will now redimension, ignoring Legend location. Your responsibility now. 
    tChart1.Panel.MarginBottom = 35; //make room. This is % .. can set as pixels, see MarginUnits 
    tChart1.Legend.Left = tChart1.Axes.Left.Position; //lineup with Left Axis 
    tChart1.Legend.Top = tChart1.Axes.Bottom.Position + tChart1.Axes.Bottom.Labels.Font.Size + 20; //make Top relative to Chart bottom axis location 
    tChart1.Legend.AutoSize = false; //now set dimension you require 
    tChart1.Legend.Width = 130; //your settings 
    tChart1.Legend.Height = 70; 

壞處是你沒有提供的多個列的這種方法(就像把Legend仍然認爲它是垂直的);先前的建議(底部傳奇上的MaxNumRows)可能仍然更合意。