1
Vote

Setting PieChart Color Dynamically, stopping LegendItemClick in code behind

description

Below is my code, I am using asp.net Code behind to draw piechart (HighChart Version 1.0), client liked everything and now he wants to :
  1. Set Pie Colors dynamically.
  2. Stopping LegenItemClick .
Pls Help urgently, i got totally stuck , not getting any help.

Abc.ascx :

<highchart:PieChart borderstyle="None" borderwidth="0" id="hcPie" width="400" height="200" runat="server" />

Abc.ascx.cs :
series.Add(new Serie
        {
            size = 130,
            innerSize = 60,
            data = dataObj.ToArray()                               

        });
        hcPie.Legend = new Legend
        {

            layout = Layout.vertical,
            align = Align.center,
            verticalAlign = Highchart.Core.VerticalAlign.bottom,
            enabled = true,
            borderWidth = 0,
            borderRadius = 0
        };

        hcPie.PlotOptions = new Highchart.Core.PlotOptions.PlotOptionsPie
        {
            allowPointSelect = false,
            cursor = "pointer",
            innserSize = "60%",
            dataLabels = new Highchart.Core.PlotOptions.DataLabels { enabled = false },
            showInLegend = true
        };

comments

onlymukund wrote Jul 30, 2014 at 11:46 AM

Hello guys,
Pls help with the above issue, I tried using dotnet.highchart for avoiding above problems but it got stuck in updatepanel refresh issue.
Not sure why highchart and dotnet.highchart having implementation differences.
In Highchart:
  • Have to add tag in web.config and use it in ascx like <highchart:PieChart .
  • Works prefect in updatepanel postbacks and usercontrols etc.
  • Problem is that it don't provide enough properties to handle dynamic colors setting and legend click handling.
In DotNet.Highchart:
  • Have to use label in ascx and from codebehind lbl.text=chart.tohtmlstring.
  • It provides dynamic color setting and legend click handling.
  • But this code do not handle updatepanel refresh properly, it got disappear on updatepanel postback.
Guys ............pls....