Member 7673567
static string conString = ConfigurationManager.ConnectionStrings["Connections"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<PieSeriesData> PieDataList = new List<PieSeriesData>();
DataTable dt = piedatatable;
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
Double count = Convert.ToDouble(dr[CountColumn]);
String Name = Convert.ToString(dr[NameColumn]);
PieDataList.Add(new PieSeriesData { Name = Name, Y = count });
}
Highcharts higcharts = new Highcharts
{
Chart = new Chart
{
Type = ChartType.Pie,
Height = 350,
Options3d = new ChartOptions3d
{
Enabled = true,
Alpha = 25,
Beta = 0
}
},
Credits = { Enabled = false },
PlotOptions = new PlotOptions
{
Pie = new PlotOptionsPie
{
AllowPointSelect = true,
SlicedOffset = 20,
Cursor = PlotOptionsPieCursor.Pointer,
Depth = 45,
DataLabels = new PlotOptionsPieDataLabels
{
Enabled = true,
Format = "{point.name}<br/>{point.count}"
},
ShowInLegend = false
}
}
,
Title = new Title
{
Text = pietittle,
X = -20
},
Legend = new Legend
{
Layout = LegendLayout.Horizontal,
Align = LegendAlign.Center,
BorderWidth = 0
},
Navigation = {
ButtonOptions=
{
Enabled= false
}
},
Series = new List<Series>
{
new PieSeries
{
Name = pieseriesname,
Data = PieDataList as List<PieSeriesData>,
Size="80%"
}
}
};
HighsoftNamespace Highsoft = new HighsoftNamespace();
string result = Highsoft.GetHighcharts(higcharts, "chart").ToHtmlString();
//Pichartseries.Text = result;
Response.Write(result);
}
}
}
public DataTable piedatatable { get; set; }
public String pietittle { get; set; }
public String pieseriesname { get; set; }
public bool showinlegend { get; set; }
public String CountColumn { get; set; }
public String NameColumn { get; set; }
}
Вот как вы можете связать pichart из кода позади in asp.net highchart