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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:33:13+00:00 2026-06-10T04:33:13+00:00

I am trying a method to bind data to the Pie chart Public ActionResult

  • 0

I am trying a method to bind data to the Pie chart

  Public ActionResult Charts
  {
      Highcharts chart = new Highcharts("chart")
        .InitChart(new Chart { PlotShadow = false })
        .SetTitle(new Title { Text = "Browser market shares at a specific website, 2010" })
        .SetTooltip(new Tooltip { Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; }" })
        .SetPlotOptions(new PlotOptions
        {
            Pie = new PlotOptionsPie
            {
                AllowPointSelect = true,
                Cursor = Cursors.Pointer,
                DataLabels = new PlotOptionsPieDataLabels
                {
                    Color = ColorTranslator.FromHtml("#000000"),
                    ConnectorColor = ColorTranslator.FromHtml("#000000"),
                    Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; }"
                }
            }
        })
        .SetSeries(new Series
        {
            Type = ChartTypes.Pie,
            Name = "Browser share",
            Data = new Data(new object[]
                                   {
                                       new object[] { "Firefox", 45.0 },
                                       new object[] { "IE", 26.8 },
                                       new DotNet.Highcharts.Options.Point
                                       {
                                           Name = "Chrome",
                                           Y = 12.8,
                                           Sliced = true,
                                           Selected = true
                                       },
                                       new object[] { "Safari", 8.5 },
                                       new object[] { "Opera", 6.2 },
                                       new object[] { "Others", 0.7 }
                                   })
                             });
        }
    }

    public JsonResult GetData()
    {
        int Param1;
        Param1 = 1;     
        var reports = db.ExecuteStoreQuery<ResourceReports>("ResourceReports @EmployeeID", new SqlParameter("@EmployeeID", Param1)).ToList();
        return Json(reports, JsonRequestBehavior.AllowGet);
    }

i want to replace

    .SetSeries(new Series
    {
        Type = ChartTypes.Pie,
        Name = "Browser share",
        Data = new Data(new object[]
                                   {
                                       new object[] { "Firefox", 45.0 },
                                       new object[] { "IE", 26.8 },
                                       new DotNet.Highcharts.Options.Point
                                       {
                                           Name = "Chrome",
                                           Y = 12.8,
                                           Sliced = true,
                                           Selected = true
                                       },
                                       new object[] { "Safari", 8.5 },
                                       new object[] { "Opera", 6.2 },
                                       new object[] { "Others", 0.7 }
                                   })
        });
    }

with my GetData() how can i do this,the Data in .SetSeries should be my returned data in GetData method

  • 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-10T04:33:15+00:00Added an answer on June 10, 2026 at 4:33 am

    It appears you are using Dotnet.Highcharts. You could create a list of Series and a list of Point.

    List<Series> mySeries = new List<Series>();
    List<Point> myPoints = new List<Point>();
    

    I would loop through each series you need to create and generate the point data like so:

    myPoints.Add(new Point {
        X = (detailRec.RecordTime - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds,
        Y = detailRec.TotalCount
    });
    

    Then you could create the series itself using the list of points for its data like so:

    mySeries.Add(new Series{
      Name = distinctDistrict.Name,
      Data = new Data(myPoints.ToArray())
    });
    

    Then to set the Series you could use the following statement:

    .SetSeries(mySeries.Select(s => new Series { 
      Name = s.Name, 
      Data = s.Data 
    }).ToArray())
    

    If you use the object browser in Visual Studio, you can see the other properties and methods of the Series and Point class. To use the above code you will have to include the the following using statements:

    using DotNet.Highcharts;
    using DotNet.Highcharts.Enums;
    using DotNet.Highcharts.Helpers;
    using DotNet.Highcharts.Options;
    using Point = DotNet.Highcharts.Options.Point;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a generic method that would bind any asp.net UI
When trying to use SPWeb.GetSiteData(SPSiteDataQuery) (Trying to bind some data to SPGridView), it throws
I am trying to bind the data from linq xml in isolated storage. The
I'm trying to use LINQ to bind the data in my GridView. In my
I'm trying to access the data that I previously allocated with the calloc method
I'm trying to bind a data value to an attached property. However, it just
I am trying to populate Select using knockout data-bind option for a list of
I am trying to bind Asp.Net Repeater Control for Ajax Data using DataTables Plugin
I'm trying to bind a page initialize event from, afaik, jquerymobile, to a method
I am trying to do method profiling for my application on Android 2.1 htc

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.