Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

XML
<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 code is

C#
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.
Posted
Updated 5-Jul-15 20:57pm
v2

1 solution

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]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900