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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:36:42+00:00 2026-05-24T00:36:42+00:00

I am using the MSChart Control to plot some data but I would like

  • 0

I am using the MSChart Control to plot some data but I would like to plot two different graphs
together on the same chart. For example, use a Bar chart (series1) with a pie chart (series2)

i am trying to show the two different graphs using one single chart by using following code
It was showing data correct but one problem is i want to show the two graphs (PIE CHART , BAR CHART ) but it was showing (“TWO PIE Charts”)

Can any one help on this

NOte : I am using one chart for all these operations

  private void kpicartmouse_click(object sender, MouseEventArgs e)
  {
    Series acceptseries;
    Series membershiptypeseries = null;
      Title title;
    string area;

  try
  {
    var pos = e.Location;
    var results = kpiChartControl.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint);
    foreach (var result in results)
    {
      if (result.ChartElementType == ChartElementType.DataPoint)
      {


        DataTable visits = null;
        visits = KPIData.Visits(dtStartDate.Value,dtEndDate.Value, mf);

        DataTable accepts = null;
        accepts = KPIData.AcceptedvisitsByMembership(mf);

        area = "subchart";
        kpiChartControl.ChartAreas.Add(area);
        acceptseries = kpiChartControl.Series.Add(area);
        acceptseries.ChartArea = area;

        title = kpiChartControl.Titles.Add("Accepted Visits By MemberShip Type");
        title.DockedToChartArea = area;
        title.Font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
        title.Alignment = ContentAlignment.TopLeft;
        kpiChartControl.Titles.Add("").DockedToChartArea = area;
        kpiChartControl.Titles.Add("Accepted visits by memebrship types").DockedToChartArea = area;



        foreach (Title titles in kpiChartControl.Titles)
        {
          titles.IsDockedInsideChartArea = false;
        }

        foreach (ChartArea chartArea in kpiChartControl.ChartAreas)
        {
          chartArea.Area3DStyle.Enable3D = true;
          chartArea.Area3DStyle.Inclination = 45;
          //chartArea.AxisX.LabelStyle.IsEndLabelVisible = !overview;
        }

        foreach (Series chartSeries in kpiChartControl.Series)
        {
          chartSeries.ChartType = SeriesChartType.StackedColumn;
          chartSeries["ColumnDrawingStyle"] = "SoftEdge";
          chartSeries["LabelStyle"] = "Top";
          chartSeries.IsValueShownAsLabel = true;
          chartSeries.BackGradientStyle = GradientStyle.DiagonalLeft;
        }
        foreach (Series chartSeries in kpiChartControl.Series)
        {
          chartSeries.ChartType = SeriesChartType.Pie;

          chartSeries["PieLabelStyle"] = "Outside";
          chartSeries["DoughnutRadius"] = "30";
          chartSeries["PieDrawingStyle"] = "SoftEdge";

          chartSeries.BackGradientStyle = GradientStyle.DiagonalLeft;
        }





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

        if (accepts == null)
        {
          acceptseries.Points.Clear();
          acceptseries.Points.AddXY("no live", 0);
        }
        if (visits == null)
        {
          membershiptypeseries.Points.Clear();
          membershiptypeseries.Points.AddXY("no membershiptypes", 0);


        }

        kpiChartControl.Series[0].Points.DataBindXY(accepts.Rows, "mshipname", accepts.Rows, "Value");
        kpiChartControl.Series["subchart"].Points.DataBindXY(visits.Rows, "Status", visits.Rows, "Visits");



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

            switch (point.AxisLabel)
            {
              case "Accepted": point.Color = Color.Green; break;
              case "Refused": point.Color = Color.Red; break;

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

        }

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

            switch (point.AxisLabel)
            {
              case "Silver membership": point.Color = Color.Green; break;
              case "Gold Membership": point.Color = Color.Blue; break;
              //case "Refused": point.Color = Color.Red; break;
              case "Weekend Peak": point.Color = Color.Cyan; break;
              case "prspect": point.Color = Color.Indigo; break;


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

        }





      }
    }
  }
  catch
  {
  }


}
  • 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-24T00:36:43+00:00Added an answer on May 24, 2026 at 12:36 am

    Just a guess… won’t this block of code force all your charts to be Pie charts?

        foreach (Series chartSeries in kpiChartControl.Series)
        {
          chartSeries.ChartType = SeriesChartType.Pie;
    
          chartSeries["PieLabelStyle"] = "Outside";
          chartSeries["DoughnutRadius"] = "30";
          chartSeries["PieDrawingStyle"] = "SoftEdge";
    
          chartSeries.BackGradientStyle = GradientStyle.DiagonalLeft;
        }
    

    If this doesn’t help, then try breaking your code down into smaller methods, then commenting each bit out in turn – then you’ll be able to understand what each bit does.

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

Sidebar

Related Questions

I am trying to generate a chart using the MS Chart Control in ASP.NET
I 'm creating a Line chart using WPFToolKit. The chart comes up fine but
Using online interfaces to a version control system is a nice way to have
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
i'm using the WPFToolkit to create a line chart with multiple LineSeries(multiple colors). I
I'm using System.Web.Helpers.Chart to display charts in my MVC3 application. @{ var myChart =
I'm currently using the charting within .NET using System.Windows.Forms.DataVisualization.Charting.Chart . Thus far it seems
Using PyObjC , you can use Python to write Cocoa applications for OS X.

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.