-1

i have created a simple chart by using HighChart please give me some suggestions and guide how can i get value from database

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Chartz.aspx.cs" Inherits="Chartz" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
   <script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>   
   <script>
       $(function () {
           $('#container').highcharts({
               chart: {
                   type: 'pie',
                   options3d: {
                       enabled: true,
                       alpha: 45,
                       beta: 0
                   }
               },
               title: {
                   text: 'Medicine market shares  2016'
               },
               tooltip: {
                   pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
               },
               plotOptions: {
                   pie: {
                       allowPointSelect: true,
                       cursor: 'pointer',
                       depth: 35,
                       dataLabels: {
                           enabled: true,
                           format: '{point.name}'
                       }
                   }
               },
               series: [{
                   type: 'pie',
                   name: 'Medicine share',
                   data: [
                       ['Epilepsy medicines', 45.0],
                       ['Biological medicines ', 26.8],
                       {
                           name: 'Ciclosporin ',
                           y: 12.8,
                           sliced: true,
                           selected: true
                       },
                       ['Mesalazine ', 8.5],
                       ['Lithium ', 6.2],
                       ['Others', 0.7]
                   ]
               }]
           });
       });
   </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     <div class="row col-md-offset-1" data-spy="scroll" style="padding:80px 0px 0px 10px;" >
         <div id="container" style="height: 400px"></div>
     </div>
</asp:Content>

i want to get value from database its working now and i have hard coded value please give me guide or reference link Help in advance

4
  • If the data is (as I suspect) the series attribute, then you can change it to series: <%= GetData() %> and create a protected function in the code behind called, GetData(), that returns a string. Get the data from your database and build the string as required by HighChart . Commented May 18, 2016 at 10:46
  • i am trying to implement through web method and with json (data is now retrieved) but problem is now how to interact this with HighChart to show my relevent data on Highchart? Commented May 18, 2016 at 12:29
  • I'm not marking this as a duplicate to be closed, as this link only answers part of your question. You'll need to look at getting the data via a webmethod in order to expand on this... stackoverflow.com/questions/16407901/… If you can post code to show your existing webmethod then that will help us help you. Commented May 18, 2016 at 12:32
  • o.k thanks i have to implement it in my code first Commented May 18, 2016 at 12:47

1 Answer 1

1

You need to set data: <%=chartData%> and get the data from database and deserialize it to show in charts.

refer this link .

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks this link help me a lot and i have found my solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.