Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6128383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:37:15+00:00 2026-05-23T16:37:15+00:00

I’m trying to create a stacked bar chart , But I’m getting an error

  • 0

I’m trying to create a stacked bar chart ,
But I’m getting an error in the lines that has “.Series ” (How to define the Series ? )

    SeriesChartType chart1 = new SeriesChartType();

    // Populate series data
    Random random = new Random();

    for (int pointIndex = 0; pointIndex < 10; pointIndex++)
    {
        chart1.Series["LightBlue"].Points.AddY(random.Next(45, 95));
    }

    // Set chart type
    chart1.Series["LightBlue"].ChartType = SeriesChartType.StackedArea100;

    // Show point labels
    chart1.Series["LightBlue"].IsValueShownAsLabel = true;

    // Disable X axis margin
    chart1.ChartAreas["Default"].AxisX.IsMarginVisible = false;

    // Set the first two series to be grouped into Group1
    chart1.Series["LightBlue"]["StackedGroupName"] = "Group1";
    chart1.Series["Gold"]["StackedGroupName"] = "Group1";

    // Set the last two series to be grouped into Group2
    chart1.Series["Red"]["StackedGroupName"] = "Group2";
    chart1.Series["DarkBlue"]["StackedGroupName"] = "Group2";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:37:15+00:00Added an answer on May 23, 2026 at 4:37 pm

    The source code above seems to be from the MS Chart Samples application. Looking at the MS example stacked bar chart on screen, and the source code above, its obvious that the sample code is inadequate and does not show us how to do stacked bar charts.

    You can either programmatically create and attach a series:

    Series s1 = new Series("LightBlue");
    s1.ChartType = SeriesChartType.StackedBar100;
    chart1.Series.Add(s1);
    

    or alternatively, you can define the series in your ASPX file and simple add Y values to each series in the code behind:

    Random  random = new Random();
    for(int pointIndex = 0; pointIndex < 10; pointIndex++)
    {
        Chart1.Series["Series1"].Points.AddY(Math.Round((double)random.Next(45, 95),0));
        Chart1.Series["Series2"].Points.AddY(Math.Round((double)random.Next(5, 75),0));
        Chart1.Series["Series3"].Points.AddY(Math.Round((double)random.Next(5, 95),0));
        Chart1.Series["Series4"].Points.AddY(Math.Round((double)random.Next(35, 95),0));
    }
    

    In the MS Chart Samples web solution, have a look at

    /ChartTypes/BarColumnCharts/Stacked/stackedchart.aspx
    

    it should have all you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.