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 7041489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:03:08+00:00 2026-05-28T02:03:08+00:00

I would like to create a main overview chart with asp:chart control, like this:

  • 0

I would like to create a main overview chart with asp:chart control, like this:

enter image description here

Instead of Andrew, etc. it would be fiscal years (2009, 2010, 2011, etc.) and the products would be the 4 types of costs.
But how do I do this with a list of custom objects that are contstructed like this:

List< Cost_cost > listOfCosts

  • Cost

    • Type (can be one of four types)
    • Amount (float)
    • Fiscal Year

Anybody got a link or tips on how to handle this?

  • 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-28T02:03:08+00:00Added an answer on May 28, 2026 at 2:03 am

    Found a solution, it’s partialy hard coded, i.e., the types of costs but since it needs to be uploaded by the day after tomorrow, it’ll do.

    The following code of course is after I created Chart1, the mainlegend and area and some styling stuff:

    //Set the amount of the four series to zero
    float totalAmountHousing = 0, totalAmountPersonnel = 0, totalAmountServices = 0, totalAmountIT = 0;
    
    //Create the four series per year
    Series sr = new Series(); Series sr2 = new Series(); Series sr3 = new Series(); Series sr4 = new Series();
    
    //Set the series to the same chart area
    sr.ChartArea = "mainArea"; sr2.ChartArea = "mainArea"; sr3.ChartArea = "mainArea"; sr4.ChartArea = "mainArea";
    
    //Set them to the same legend
    sr.Legend = "mainLegend"; sr2.Legend = "mainLegend"; sr3.Legend = "mainLegend"; sr4.Legend = "mainLegend";
    
    //Set the names of the 4 series
    sr.Name = "Housing"; sr2.Name = "IT"; sr3.Name = "Services"; sr4.Name = "Personnel";
    
    //Add the series to the chart
    Chart1.Series.Add(sr); Chart1.Series.Add(sr2); Chart1.Series.Add(sr3); Chart1.Series.Add(sr4);
    
    //Set drawing style to cylinder of the four costs
    Chart1.Series["Housing"]["DrawingStyle"] = "Cylinder";
    Chart1.Series["IT"]["DrawingStyle"] = "Cylinder";
    Chart1.Series["Services"]["DrawingStyle"] = "Cylinder";
    Chart1.Series["Personnel"]["DrawingStyle"] = "Cylinder";
    
    for (int i = 0; i < listOfFiscalYears.Count; i++) {
    
        //generate some point for the chart
        for (int j = 0; j < listOfCosts.Count; j++) {
            if ((listOfCosts[j].Type).ToLower() == "housing"    && listOfCosts[j].Cost_fiscalYear.Year == int.Parse(listOfFiscalYears[i].ToString())) totalAmountHousing += (float)listOfCosts[j].Amount;
            if ((listOfCosts[j].Type).ToLower() == "it"         && listOfCosts[j].Cost_fiscalYear.Year == int.Parse(listOfFiscalYears[i].ToString())) totalAmountIT += (float)listOfCosts[j].Amount;
            if ((listOfCosts[j].Type).ToLower() == "services"   && listOfCosts[j].Cost_fiscalYear.Year == int.Parse(listOfFiscalYears[i].ToString())) totalAmountServices += (float)listOfCosts[j].Amount;
            if ((listOfCosts[j].Type).ToLower() == "personnel"  && listOfCosts[j].Cost_fiscalYear.Year == int.Parse(listOfFiscalYears[i].ToString())) totalAmountPersonnel += (float)listOfCosts[j].Amount;
        }
    
        Chart1.Series["Housing"].Points.Add(totalAmountHousing);
        Chart1.Series["IT"].Points.Add(totalAmountIT);
        Chart1.Series["Services"].Points.Add(totalAmountServices);
        Chart1.Series["Personnel"].Points.Add(totalAmountPersonnel);
        Chart1.ChartAreas["mainArea"].AxisX.Interval = 1;
    
        //Add custom label to the X axis
        Chart1.ChartAreas[0].AxisX.CustomLabels.Add(new CustomLabel(i, i + 2, (listOfFiscalYears[i].ToString()), 0, LabelMarkStyle.None));
    
        //Reset the total cost after they have been added for the year
        totalAmountHousing = 0; totalAmountPersonnel = 0; totalAmountServices = 0; totalAmountIT = 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a new dynamic chart control. This chart will have
I would like create a web service in ASP.Net 2.0 that will supports JSON.
Okay look first thanks for this place :) I would like to create a
I've just started using Ancestry instead of awesome_nested_set and I would like to create
I would like to create my logout view for many reasons but the main
i would like to create a procedure on this. procedure TForm1.Button1Click(Sender: TObject); var a:
I would like to create an executable of my two mycode.c and my main.c,
I would like to create arrays like this: string users[1][3]; users[CIRK][age] = 20; users[CIRK][country]
I would like to create a table in my Jasper Report. This could be
I would like create my own collection that has all the attributes of python

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.