Note that there are some explanatory texts on larger screens.

plurals
  1. POStacked Column Chart not displaying the way I would like
    primarykey
    data
    text
    <p>I will start by quickly saying I am a first time poster but a long time lurker here. I have exhausted all resources at my disposal trying to figure this problem out and have decided to post my problem now!</p> <p>So I am working on some graphing functionality for an application I am building, right now it is in very basic stage just so I can have the correct output. My goal for this graphing portion of the application is to have two stacked column charts beside one another with different data in each. They consist of 5 series (both the same).</p> <p>Here is my current code:</p> <pre><code> private void GraphingForm_Load(object sender, EventArgs e) { //Set the title chart.Titles.Add("Title"); // Populate series data string[] seriesArray = {"s1", "s2", "s3", "s4", "s5" }; double[] data = { 10.5, 30.10, 90.4, 32.5, 12.0, 1, 1, 1, 1, 1 }; //Graph Series and bind data for (int i = 0; i &lt; data.Length; i++) { Series series = chart.Series.Add(seriesArray[i]); series.Points.Add(data[i]); chart.Series[seriesArray[i]].IsValueShownAsLabel = true; series.ChartType = SeriesChartType.StackedColumn; } // Set to 3D //chart.ChartAreas["Default"].Area3DStyle.Enable3D = true; //chart.ChartAreas["Default"].Area3DStyle.LightStyle = LightStyle.Simplistic; } </code></pre> <p>So what the output look's like is basically displaying only the first 5 numbers from the data array partitioned correctly with the respective series. However the other 5 data values I have (1,1,1,1,1) which I wanted to graph beside the first stacked column chart bar (I am not sure what to call that) will not display. I have started this stuff just last night and have been following the Microsoft chart tutorials along with lot's of online resources. </p> <p>Here's <a href="http://imgur.com/qaxl9" rel="nofollow">a link to a screenshot of the output in case it helps</a>!</p> <p>Also a side note, the commented out code for setting the chart to 3D does not work. It would be great if someone can shed some light on that too. It was taken directly from the Microsoft chart example code.</p> <p>I apologize for the longevity of this post and hope you guy's can help!</p> <p>/* EDIT FOR SOLUTION */</p> <p>I was able to fix this issue...not the best implementation technique but it works - here is my revised code. </p> <pre><code> string[] seriesArray = {"s1", "s2", "s3", "s4", "s5" }; double[] data = { 10.5, 30.10, 90.4, 32.5, 12.0}; double[] data2 = { 1,1,1,1,1}; //first stacked bar for (int i = 0; i &lt; seriesArray.Length; i++) { chart.Series[seriesArray[i]].Points.AddY(data[i]); } //second stacked bar for (int i = 0; i &lt; seriesArray.Length; i++) { chart.Series[seriesArray[i]].Points.AddY(data2[i]); } </code></pre> <p>I welcome any better solutions as this is probably not that great design wise.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload