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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:32:34+00:00 2026-06-11T05:32:34+00:00

I am working in .Net Charts. I am trying to generate a Column chart.

  • 0

I am working in .Net Charts. I am trying to generate a Column chart. I am having two rows in my dataset. Here is my code.

                    DataTable DT1 = new DataTable();
                    DT1 = chartViewSummaryList;
                    DataView DV = DT1.DefaultView;
                    DV.ToTable(false, new string[] { "REVENUE_TOTAL", "WEEK_END_DATE" });

                    DataSet ds = new DataSet();
                    ds.Tables.Add(DT1.Copy());

                    ds.Tables[0].Rows[0]["MARGIN"] = "0";
                    ds.Tables[0].Rows[0]["REVENUE_TOTAL"] = "3776169.61";
                    ds.Tables[0].Rows[0]["MARGIN_PCT"] = "0";
                    ds.Tables[0].Rows[0]["VISIT_REVENUE_AVG"] = "29.28";
                    ds.Tables[0].Rows[0]["VISIT_COUNT"] = "614041";
                    ds.Tables[0].Rows[0]["REVENUE_SALE"] = "1840387.18";
                    ds.Tables[0].Rows[0]["REVENUE_REGULAR"] = "1935782.43";
                    ds.Tables[0].Rows[0]["WEEK_END_DATE"] = "1/1/2012 12:00:00 AM";

                    ds.Tables[0].Rows.Add();

                    ds.Tables[0].Rows[1]["MARGIN"] = "1";
                    ds.Tables[0].Rows[1]["REVENUE_TOTAL"] = "5776169.61";
                    ds.Tables[0].Rows[1]["MARGIN_PCT"] = "0";
                    ds.Tables[0].Rows[1]["VISIT_REVENUE_AVG"] = "49.28";
                    ds.Tables[0].Rows[1]["VISIT_COUNT"] = "814041";
                    ds.Tables[0].Rows[1]["REVENUE_SALE"] = "3840387.18";
                    ds.Tables[0].Rows[1]["REVENUE_REGULAR"] = "3935782.43";
                    ds.Tables[0].Rows[1]["WEEK_END_DATE"] = "1/1/2012 12:00:00 AM";



                    Chart1.DataSource = ds;

                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        Chart1.Titles.Add(storeLevelCaption).Font = new System.Drawing.Font("Verdana", 11, FontStyle.Bold);
                        Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Weeks";
                        Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont = new System.Drawing.Font("Verdana", 10, FontStyle.Bold);
                        Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new Font(new FontFamily("Verdana"), 7.25F, FontStyle.Bold);
                        string series = "Series" + i;
                        Chart1.Series.Add(series);

                        Chart1.Series[series].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column;

                        Chart1.Series[series].XValueMember = "WEEK_END_DATE";
                        Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;

                        Color color = System.Drawing.ColorTranslator.FromHtml("#B93B8F");
                        Chart1.Series[series].Color = color;

                        Chart1.ChartAreas["ChartArea1"].AxisY.Title = "Total Revenue";
                        Chart1.ChartAreas["ChartArea1"].AxisY.TitleFont = new System.Drawing.Font("Verdana", 10, FontStyle.Bold);
                        Chart1.ChartAreas["ChartArea1"].AxisY.LabelStyle.Font = new Font(new FontFamily("Verdana"), 7.25F, FontStyle.Bold);
                        Chart1.Series[series].YValueMembers = "REVENUE_TOTAL";
                        Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;

                        Chart1.Series[series].ToolTip = "Total Revenue ($) , " + ds.Tables[0].Rows[i]["WEEK_END_DATE"].ToString() + " , " + ds.Tables[0].Rows[i]["REVENUE_TOTAL"].ToString();

                        Chart1.Series[series].Font = new Font(new FontFamily("Verdana"), 7.25F, FontStyle.Bold);
                        //Chart1.Series[series].Name = "Total Revenue";
                    }
                    Chart1.ChartAreas[0].AxisY.Interval = 1;
                    Chart1.DataBind();

I am getting the chart, where two column combined together and displayed as one column. Where i had gone wrong…

  • 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-06-11T05:32:35+00:00Added an answer on June 11, 2026 at 5:32 am

    I can’t reproduce your problem using the WinForm charting assemblies. However you may want to try using distinct dates since they are bound to your X values.

    ds.Tables[0].Rows[0]["WEEK_END_DATE"] = "1/1/2012 12:00:00 AM";
    ds.Tables[0].Rows[1]["WEEK_END_DATE"] = "8/1/2012 12:00:00 AM"; // a different date
    

    FYI, I changed your code minimaly

            // DT1 = chartViewSummaryList;
            // replace unknown object with this code
            DT1.Columns.Add(new DataColumn("MARGIN"));
            DT1.Columns.Add(new DataColumn("REVENUE_TOTAL"));
            DT1.Columns.Add(new DataColumn("MARGIN_PCT"));
            DT1.Columns.Add(new DataColumn("VISIT_REVENUE_AVG"));
            DT1.Columns.Add(new DataColumn("VISIT_COUNT"));
            DT1.Columns.Add(new DataColumn("REVENUE_SALE"));
            DT1.Columns.Add(new DataColumn("REVENUE_REGULAR"));
            DT1.Columns.Add(new DataColumn("WEEK_END_DATE"));
    

    and also added a row manually

            ds.Tables.Add(DT1.Copy());
            ds.Tables[0].Rows.Add(); // Added this
    

    and got two columns from your plotting code.

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

Sidebar

Related Questions

I'm working with C# .NET 3.5, Dundas Charts 7.2. Here is the chart I
Just started working with .NET and MVC(1). I'm having a problem wherein in my
I'm working with code I'm converting to Pgsql working with .NET. I want to
I'm using ASP.Net with MVC 3 and trying to auto generate images. In my
I've a working .Net website, I get the code from the server and copy/past
i am working on thr Chart with Point Labels inside my asp.net mvc as
http://www.asp.net/webmatrix/tutorials/7-displaying-data-in-a-chart goes over how to create simple charts and they are working, but I
I am working on a .NET application that displays multiple charts. My users would
I have started using MS charts in ASP.NET 3.5 with code behind in C#
I'm working on some bar charts and need to update the chart values. 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.