2013-08-22 80 views
0

我使用Teechart for .net V3。Teechart:底部軸線標籤角度

當試圖將X標籤旋轉到45°時,某些標籤不會顯示,但如果將角度設置爲90°,則可以。

請看下面的圖片:

這是45°旋轉: 45° rotation

這是90°旋轉: enter image description here

是否可以顯示所有標籤45°角?

回答

1

我認爲你可以使用自定義標籤來實現當你使用45º角度時出現的所有標籤。你可以做下一個代碼:

private Steema.TeeChart.TChart tChart1; 
public Form1() 
{ 
    InitializeComponent(); 
    tChart1 = new Steema.TeeChart.TChart(); 
    this.Controls.Add(tChart1); 
    tChart1.Left = 100; 
    tChart1.Top = 50; 
    tChart1.Width = 500; 
    tChart1.Height = 350; 
    tChart1.Dock = DockStyle.Fill; 
    InitialzieChart(); 
} 
private void InitialzieChart() 
{ 
    Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart); 
    DateTime dt = DateTime.Today; 
    Random rnd = new Random(); 
    bar1.XValues.DateTime = true; 
    //bar1.date 
    for (int i = 0; i < 20; i++) 
    { 
    bar1.Add(dt, rnd.Next(100)); 
    dt = dt.AddDays(5); 
    } 

    tChart1.Axes.Bottom.Labels.Angle = 45; 
    tChart1.Panel.MarginLeft = 10; 
    tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom; 
    AddCustomLabels(); 
} 
private void AddCustomLabels() 
{ 
    tChart1.Axes.Bottom.Labels.Items.Clear(); 
    for (int i = 0; i < tChart1[0].Count; i++) 
    { 
    tChart1.Axes.Bottom.Labels.Items.Add(tChart1[0].XValues[i], DateTime.FromOADate(tChart1[0].XValues[i]).ToLongDateString()); 
    } 
} 

你能告訴我們,如果以前的代碼在你的最終?

謝謝,

相關問題