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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:42:53+00:00 2026-06-06T07:42:53+00:00

I’m new to web design and am trying to populate a highcharts pie chart

  • 0

I’m new to web design and am trying to populate a highcharts pie chart with data from SQL Database using C#. I have done it sucessfully for a Bar Chart but am having trouble with a pie chart. Basically i have a table tblReport1 that contains 2 fields CustomerType and TotalOrders

I can get it to bring in the values but i can’t get my slices to rename to the data in CustomerType field. I have tried a couple of suggestions on this forum but can’t get them to work. Below is my code any suggestions would be grateful.

private void Report1()
{
    dsSeries = BindData();

    if (dsSeries == null) return;

    foreach (DataRow dr in dsSeries.Tables[0].Rows)
    {
        hidXCategories11.Add(dr["CustomerType"]);
    }

    foreach (DataRow dr1 in dsSeries.Tables[0].Rows)
    {
        hidValues11.Add(Convert.ToInt32(dr1["TotalOrders"]));
        yValues = hidValues11.ToArray(typeof(object)) as object[];
    }


    DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
    .InitChart(new Chart { PlotShadow = false })
    .SetTitle(new Title { Text = "Orders by Customer Type" })
    .SetTooltip(new Tooltip { Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.y +' Orders'; }" })
    .SetPlotOptions(new PlotOptions
    {
        Pie = new PlotOptionsPie
        {
            ShowInLegend = true,
            AllowPointSelect = true,
            DataLabels = new PlotOptionsPieDataLabels
            {
                Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.y; }"
            }
        }
    })

    .SetSeries(new[]
       {
               new Series { Type = ChartTypes.Pie, Name = "help!", Data = new Data(yValues) }
       });



    ltrChart.Text = chart.ToHtmlString();

}
  • 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-06T07:42:55+00:00Added an answer on June 6, 2026 at 7:42 am

    Looking at http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/pie-basic/ the format for the pie chart data is two parts, the label and the data item.

    In yours it looks like the series data is just a single array of integers.

    So I think you’ll need to change your Series object to accept a different format of data.

    Sadly the examples in the Highcharts.Net documentation are a little lacking and don’t seem to have examples of this so you might have to look at what the intellisense has to offer.

    The bottom line though is that your pie wedges need to be named in the data series, not as categories or anything else.

    Edit for some sample code

    I was looking at their site and they have a help forum there with the following sample code amongst it

           series.Add(new Serie
            {
                data = new object[] { 
                    new object[] { "Firefox", 45 }, 
                    new object[] { "IE", 24.8 }, 
                    new object[] { "Chrome", 12.8 },
                    new object[] { "Safari", 8.5 }, 
                    new object[] { "Opera", 5.2 }, 
                    new object[] { "Outros", 3.7 } 
                }
            });
    

    Source: http://highcharts.codeplex.com/discussions/269347

    I can’t test this but from the context of the post it looks like it should do the job.

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

Sidebar

Related Questions

I have a view passing on information from a database: def serve_article(request, id): served_article
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a reasonable size flat file database of text documents mostly saved in
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put

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.