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

  • Home
  • SEARCH
  • 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 6210017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:05:15+00:00 2026-05-24T06:05:15+00:00

I am using win forms application I am using single ms chart control and

  • 0

I am using win forms application
I am using single ms chart control and generating two different charts and want to show two on same page by using bool overview (this means when the applications runs one graph will be shown and if you click on that graph i want to show another one along with this one ) by the following code

      private void chartControlMemberTotals_Click(object sender, EventArgs e)
     {

       kpiMemberTotalsForm.DrawKpi(this.chartControlMemberTotals, startDate, endDate, true);
     }





 public void DrawKpi(Chart targetChartControl, DateTime StartDate, DateTime EndDate, bool Overview)
{
  try
  {    
    Series series = null;
    Title title;
    string area;


     targetChartControl.ChartAreas.Clear();
      targetChartControl.Series.Clear();
      targetChartControl.Titles.Clear();

        area = "Status";
      targetChartControl.ChartAreas.Add(area);
      series = targetChartControl.Series.Add(area);
      series.ChartArea = area;
      if (!Overview)
      {
        title = targetChartControl.Titles.Add("Member status");
        title.IsDockedInsideChartArea = Overview;
        title.Alignment = ContentAlignment.TopLeft;
        title.DockedToChartArea = area;


        targetChartControl.Titles.Add("").DockedToChartArea = area;
      }

      targetChartControl.Titles.Add("Members status").DockedToChartArea = area;

      area = " Live members mebershiptypes";
      targetChartControl.ChartAreas.Add(area);
      series = targetChartControl.Series.Add(area);
      series.ChartArea = area;

      if (!Overview)
      {
        title = targetChartControl.Titles.Add("Live Status  members  By MemberShip Type");
        title.Font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
        title.Alignment = ContentAlignment.TopLeft;
        title.DockedToChartArea = area;

        targetChartControl.Titles.Add("").DockedToChartArea = area;
        targetChartControl.Titles.Add("Live memberships").DockedToChartArea = area;
      }


      foreach (Title chartTitle in targetChartControl.Titles)
      {
        chartTitle.IsDockedInsideChartArea = false;
      }

      foreach (ChartArea chartArea in targetChartControl.ChartAreas)
      {
        chartArea.Area3DStyle.Enable3D = true;
        chartArea.AxisX.LabelStyle.IsEndLabelVisible = true;
      }

      if (!Overview)
      {
        foreach (Series chartSerie in targetChartControl.Series)
        {


          chartSerie.ChartType = SeriesChartType.StackedColumn;
          chartSerie["ColumnDrawingStyle"] = "SoftEdge";
          chartSerie["LabelStyle"] = "Top";
          chartSerie.IsValueShownAsLabel = true;
                    //series.CustomProperties = "DrawingStyle=Cylinder";
        chartSerie.BackGradientStyle = GradientStyle.DiagonalLeft;

        }
      }

      foreach (Series chartSeries in targetChartControl.Series)
      {
        chartSeries.ChartType = SeriesChartType.Pie;

        if (!Overview)
        {
          chartSeries["PieLabelStyle"] = "Outside";
        }
        else
        {

          chartSeries["PieLabelStyle"] = "Disabled";
        }
        chartSeries["DoughnutRadius"] = "30";
        chartSeries["PieDrawingStyle"] = "SoftEdge";

        chartSeries.BackGradientStyle = GradientStyle.DiagonalLeft;
      }

      foreach (Legend legend in targetChartControl.Legends)
      {
        legend.Enabled = false;
      }

      if (!Overview)
      {
        DataTable Accept = null;
        Accept = KPIData.livemembersmembershiptype(mf);
        targetChartControl.Series[0].Points.DataBindXY(Accept.Rows, "mshipname", Accept.Rows, "count");

        foreach (Series chartSeries in targetChartControl.Series)
        {
          foreach (DataPoint point in chartSeries.Points)
          {

            switch (point.AxisLabel)
            {
              case "Silver membership": point.Color = Color.Red; break;

            }
            point.Label = string.Format("{0:0}", point.YValues[0]);
          }
        }
      }
      DataTable reportsfull = null;
      reportsfull = KPIData.MembershipTotals(StartDate, EndDate, mf);

        targetChartControl.Series[0].Points.DataBindXY(reportsfull.Rows, "Status", reportsfull.Rows, "Value");


        foreach (Series chartSeries in targetChartControl.Series)
        {
          foreach (DataPoint point in chartSeries.Points)
          {
            switch (point.AxisLabel)
            {
              case "New": point.Color = Color.Cyan; break;
              case "Live": point.Color = Color.Green; break;

            }

            point.Label = string.Format("{0:0} - {1}", point.YValues[0], point.AxisLabel);
          }
        }
    }
 catch
  {
  }
  }

but when the application runs it shows the graph and when i clicking on the graph it shows only one graph i dont know why it was not showing another graph

is there any mistake for specifying the series and legends for the ms chart and the data is coming from database is correct

  • 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-24T06:05:16+00:00Added an answer on May 24, 2026 at 6:05 am

    Looking at your code, You are databinding the same series targetChartControl.Series[0].
    I think you need to try defining two separate chart series and assign them to the two different chart areas that you already defined. That should solve your issue.

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

Sidebar

Related Questions

Hi I am using ms chart control in win-forms application. I have a problem
I have a win forms application that contains a Web Browser control. I need
I have a user control with a textbox in a win forms application. I
In my .net 2.0 Win Forms application I want to raise something like OnProgress
I have custom control - using Win Forms, that contains four TextBoxes, all have
I have a winforms application in which I am using 2 Forms to display
I have an existing application (C#/Win forms). I need to add functionality to the
I am doing an win form application. I am using a tree view and
I'm using Windows XP and currently, I'm developing a small win form application so
I am developing a C# application (.Net 3.5, Win Forms) which is run on

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.