2017-05-31 77 views
1

我使用SQL Server 2008 Connection開發了帶有動態數據的圖表C#。標籤系列位於水平位置,但我需要更改爲垂直位置(90°)此代碼構建Web窗體並添加標籤。如何將標籤系列更改爲圖表90°(垂直)的角度c#

<asp:Chart ID="graf_hr_ralenti_vehiculo_mensual_comparativo" runat="server" Height="580px" Width="934px"> 
    <Series> 
     <asp:Series CustomProperties="DrawingStyle=Cylinder" Legend="Legend1" Name="Series1" LabelAngle="90"> 
     </asp:Series> 
     <asp:Series ChartArea="ChartArea1" CustomProperties="DrawingStyle=Cylinder" Legend="Legend1" Name="Series2"> 
     </asp:Series> 
    </Series> 
    <ChartAreas> 
     <asp:ChartArea Name="ChartArea1"> 
      <AxisY IsLabelAutoFit="False" TextOrientation ="Auto" 
        TitleFont="Verdana, 10pt" Interval="Auto"> 
        <LabelStyle Font="Microsoft Sans Serif" /> 
      </AxisY> 

      <AxisX IsLabelAutoFit="false" LabelAutoFitMaxFontSize="10" 
        LabelAutoFitMinFontSize="8" LabelAutoFitStyle="None" Interval="1"> 
        <LabelStyle Angle ="90" Font="Microsoft Sans Serif" IsEndLabelVisible ="false" />        
      </AxisX> 
     </asp:ChartArea> 
    </ChartAreas> 
    <Legends> 
     <asp:Legend Name="Legend1"> 
     </asp:Legend> 
    </Legends> 
</asp:Chart> 

此代碼C#將圖例添加爲圖例和工具提示。我檢查了圖表的屬性,但我沒有找到它!你能幫我嗎!圖片是我的圖表現在,並告訴您,我要組織

graf_hr_ralenti_vehiculo_mensual_comparativo.Titles.Add("Comparativa Vehiculos Ralenti Promedio \\n" + strmes + " VS " + strmes_comparativo).Font = new Font("Arial", 12, FontStyle.Bold); 
graf_hr_ralenti_vehiculo_mensual_comparativo.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false; 
graf_hr_ralenti_vehiculo_mensual_comparativo.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false; 
graf_hr_ralenti_vehiculo_mensual_comparativo.Series["Series1"].ToolTip = "(#VALX, #VALY)"; 
graf_hr_ralenti_vehiculo_mensual_comparativo.Series["Series2"].ToolTip = "(#VALX, #VALY)"; 

graf_hr_ralenti_vehiculo_mensual_comparativo.Series["Series1"].LegendText = strmes; 
graf_hr_ralenti_vehiculo_mensual_comparativo.Series["Series2"].LegendText = strmes_comparativo; 

graf_hr_ralenti_vehiculo_mensual_comparativo.Legends["Legend1"].Title = "Segmentación"; 

感謝enter image description here

+0

您可能需要禁用SmartLabelStyle。 – TaW

+0

謝謝,但SmartLabelStyle不控制標籤的位置! –

+0

雖然它在標籤上不會旋轉,因爲標籤會足夠聰明,以知道不需要旋轉。默認值爲'true'。隨意測試它或至少[查看](https://msdn.microsoft.com/en-us/library/system.web.ui.datavisualization.charting.smartlabelstyle(v = vs.110)。 aspx).. – TaW

回答

0

這是解決方案,進入屬性選擇「系列」 \ SmartLabelStyle - 假 然後選擇字體\ LabelAngle - 90。 感謝您的幫助! enter image description here

enter image description here