如何使用c#从左到右更改图表y轴位置 [英] How to change the chart y axis position from from left to right using c#

查看:80
本文介绍了如何使用c#从左到右更改图表y轴位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有小查询,我使用Asp.net和C#实现图表控制,图表显示如|

|

|

|

----------------



但我想从左到右改变y轴位置,如

|

|

|

|

----------



如何从左到右更改轴位置

是否可以旋转图表控件



这里我使用以下代码



。 aspx



Hi all,
I have small Query,i implemented Chart Control using Asp.net and C#,the chart displays like |
|
|
|
----------------

but i want change the y axis position left to right like
|
|
|
|
----------

How can i change a y axis position from left to right
Is it possible to rotate chart control

here i am using the below code

.aspx

<asp:Chart ID="Chart1" runat="server" Height="390px" Width="70px"

 style="">
<Series>
<asp:Series Name="Series1" YValuesPerPoint="2" ChartType="StackedBar100">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>





.aspx.cs代码是





.aspx.cs code is

DataTable table = new DataTable("NumericTable");
           table.Columns.Add("NumericRange", typeof(double));

           for (int i = 1; i <= 100; i++)
           {
               table.Rows.Add(i);
           }



           double index0 = all;
           System.Diagnostics.Debug.WriteLine(index0);


           double index2 = sector;
           System.Diagnostics.Debug.WriteLine(index2);



           double index = subsector;
           System.Diagnostics.Debug.WriteLine(index);

           Chart4.DataSource = table;
           // Chart4.Series["Series1"].XValueMember = "Ticker";
           Chart4.Series["Series1"].YValueMembers = "NumericRange";
           //Chart4.Series[0].ChartType = SeriesChartType.Bar;
           Chart4.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = true;
           Chart4.ChartAreas["ChartArea1"].AxisX.Interval = 25;
           Chart4.ChartAreas["ChartArea1"].AxisY.LabelStyle.Enabled = false;
           Chart4.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
           Chart4.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
           string title_str0 = "All";
           Chart4.Titles.Add(title_str0);
           Chart4.Titles[0].Font = new Font("Arial", 8);
           Chart4.DataBind();
           Chart4.Series[0]["PointWidth"] = "1";
           int j = 0;





任何人都可以向我分享任何想法。



Any one can you please share any idea to me.

推荐答案

你只需要禁用YAxis并启用辅助功能YAxis。



You only have to disable the YAxis and to enable the secondary YAxis.

ChartArea1.AxisY.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.[False]
 ChartArea1.AxisY2.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.[True]


这篇关于如何使用c#从左到右更改图表y轴位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆