public string ReporteTarjetasPorEmpleado() { BLL.BLLHistoricoSolicitudTarjeta bll = new BLL.BLLHistoricoSolicitudTarjeta(); var hist = bll.ObtenerHistoricoSolicitudTarjetasPorEmpleado(); Highcharts chart = new DotNet.Highcharts.Highcharts("Cantidad de patos en Australia"); chart.InitChart(new DotNet.Highcharts.Options.Chart { DefaultSeriesType = DotNet.Highcharts.Enums.ChartTypes.Column }); chart.SetTitle(new Title() { Text = "Cantidad de ventas por empleado" }); object[] datos = new object[hist.Length]; for (int i = 0; i < hist.Length; i++) { datos[i] = hist[i].Item2; } chart.SetSeries(new Series() { Data = new Data(datos), Name = "Tarjetas" }); string[] cat = new string[hist.Length]; for (int i = 0; i < hist.Length; i++) { cat[i] = hist[i].Item1; } chart.SetXAxis(new XAxis() { Categories = cat, }); chart.SetYAxis(new YAxis() { Title = new YAxisTitle() { Text = "Tarjetas" } }); string cadena = chart.ToHtmlString(); cadena = cadena.Substring(193); cadena = cadena.Substring(0, cadena.Length - 17); cadena = cadena.Replace("Cantidad de patos en Australia_container", "Chart"); return(cadena); }
// // GET: /HighChartsSampleModel/ public ActionResult Index() { var highchartSample = new List<HighChartsSampleModel> { new HighChartsSampleModel() {Parameters = "Event", GoodScore = 23.45D, AverageScore = 15.32D,BadScore = 9.4D,ActualScore=78.33D}, new HighChartsSampleModel() {Parameters = "Weather",GoodScore=45.67D,AverageScore = 33.24D,BadScore = 12.23D,ActualScore = 56.22D}, new HighChartsSampleModel() {Parameters = "User Review",GoodScore=67.23D,AverageScore = 31.23D,BadScore = 10.11D,ActualScore = 29.44D}, new HighChartsSampleModel() {Parameters = "Tweets",GoodScore = 89.67D,AverageScore = 12.33D,BadScore = 3.43D,ActualScore = 88.11D}, new HighChartsSampleModel() {Parameters = "Persona",GoodScore=38.34D,AverageScore = 25.34D,BadScore = 16.43D,ActualScore = 35.08D}, new HighChartsSampleModel() {Parameters = "Crime",GoodScore=38.34D,AverageScore = 25.34D,BadScore = 16.43D,ActualScore = 24.87D} }; var xDataParameters = highchartSample.Select(i => i.Parameters).ToArray(); var actualScore = highchartSample.Select(i => i.ActualScore); var chart = new Highcharts("chart"); chart.InitChart(new Chart { DefaultSeriesType = ChartTypes.Bar }); chart.SetTitle(new Title { Text = "Risk Score Profiling" }); chart.SetSubtitle(new Subtitle { Text = "Risk predicting using social media" }); chart.SetXAxis(new XAxis { Categories = xDataParameters }); chart.SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Scores" }, Max = 100 }); chart.SetLegend(new Legend { Enabled = false, }); chart.SetTooltip(new Tooltip { Enabled = true, Formatter = @"function(){return '<b>' + this.series.name +'</b><br/>' + this.x+':' + this.y;}" }); chart.SetPlotOptions(new PlotOptions { //Series = new PlotOptionsSeries() { Stacking = Stackings.Normal }, Bar = new PlotOptionsBar { DataLabels = new PlotOptionsBarDataLabels { Enabled = true,Color = Color.Maroon,Shadow = true}, //PointWidth = 10, //GroupPadding = 1, //PointPadding = 0, Shadow = true, BorderWidth = 1, BorderColor = Color.FloralWhite, } }); Data data = new Data( actualScore.Select(y => new Point { Color = GetBarColor(y), Y = y}).ToArray() ); chart.SetSeries(new Series { Name = "Actual Score", Data = data }); return View(chart); }
public ActionResult ChartOrders() { Highcharts orders = new Highcharts("OrderID"); orders.SetTitle(new Title() { Text = Resources.Resource.OrdersRoma }); orders.SetYAxis(new YAxis { Title = new YAxisTitle() { Text = Resources.Resource.CountRoma }, }); //var ord = orderManager.GetQueryableOrders(); var drivers = userManager.GetQueryableDrivers(); //var res = ord.Join(drivers, x => x.DriverId, y => y.Id, (x, y) => new { Name = y.UserName, Orders = 1 }).GroupBy(x=>x.Name).ToList(); List<Series> series = new List<Series>(); List<object> serieData = new List<object>(); /*foreach (var i in res) { Series serie = new Series(); serie.Name = i.Key; serie.Type = ChartTypes.Column; serieData.Clear(); serieData.Add(i.Count()); serie.Data = new Data(serieData.ToArray()); series.Add(serie); }*/ orders.SetSeries(series.ToArray()); orders.SetLegend(new Legend() { Align = HorizontalAligns.Right, Layout = Layouts.Vertical, VerticalAlign = VerticalAligns.Top }); orders.SetPlotOptions(new PlotOptions() { Area = new PlotOptionsArea() { Stacking = Stackings.Normal } }); orders.SetCredits(new Credits() { Enabled = false }); ViewBag.Order = orders; return View(); }
public string CurrentMonthGoalProgressNet() { var now = DateTime.Now; var daysInMonth = DateTime.DaysInMonth(now.Year, now.Month); var expectedPct = ((decimal)now.Day / daysInMonth); var remainingDays = daysInMonth - now.Day; var stepsPR = pedometerCalcService.StepsPR(); var remainingSteps = (int) (stepsPR-pedometerCalcService.MonthStepsActual())/remainingDays; var highchart = new Highcharts("CurrentMonthGoal"); var chart = new Chart() {Type = ChartTypes.Bar}; var categories = new List<string> {"Steps"}; var yaxis = new YAxis {Max = 1}; var seriesArray = new List<Series>(); var series = new Series {Name = "Expected",Color = Color.Red}; var data = new List<object> {pedometerCalcService.MonthPctExpected(now)}; var plotoptions = new PlotOptionsBar { Grouping = false, Shadow = false, DataLabels = new PlotOptionsBarDataLabels() { Enabled = false, Format = string.Format("Expected: {0}", (int) (stepsPR*expectedPct)), Color = Color.White } }; series.Data = new Data(data.ToArray()); series.PlotOptionsBar = plotoptions; seriesArray.Add(series); series = new Series {Name = "Actual", Color = Color.Green}; data = new List<object> { pedometerCalcService.MonthPct(now.Month, now.Year) }; plotoptions = new PlotOptionsBar { Grouping = false, Shadow = false, DataLabels = new PlotOptionsBarDataLabels() { Enabled = true, Format = string.Format("Remaining: {0}/day", remainingSteps), Color = Color.White, Shadow = false } }; series.Data = new Data(data.ToArray()); series.PlotOptionsBar = plotoptions; seriesArray.Add(series); highchart.InitChart(chart); highchart.SetTitle(new Title() {Text = "Month Progress"}); highchart.SetXAxis(new XAxis() {Categories = categories.ToArray()}); highchart.SetYAxis(yaxis); highchart.SetSeries(seriesArray.ToArray()); highchart.SetTooltip(new Tooltip() {Enabled = false}); return highchart.ToHtmlString(); }
public string AllGoalsByMonthNet() { var now = DateTime.Now; var currentMonth = new DateTime(now.Year, now.Month, 1); var startDate = currentMonth.AddYears(-1); var highchart = new Highcharts("AllGoalsMonth"); var chart = new Chart() { Type = ChartTypes.Column }; highchart.InitChart(chart); highchart.SetTitle(new Title() {Text = "Goals by Month"}); var yaxis = new YAxis {Max = 2}; highchart.SetYAxis(yaxis); var series = new Series {Name = "Steps"}; var xaxis = new XAxis(); var categories = new List<string>(); var data = new List<object>(); for (var i = startDate; i <= currentMonth; i = i.AddMonths(1)) { categories.Add(i.Month.ToString() + "-" + i.Year.ToString()); data.Add(pedometerCalcService.MonthPct(i.Month, i.Year)); } xaxis.Categories = categories.ToArray(); series.Data = new Data(data.ToArray()); highchart.SetXAxis(xaxis); highchart.SetSeries(series); return highchart.ToHtmlString(); }
// // GET: /Home/ public ActionResult Index() { DbDataContext dt = new DbDataContext(); //Fetching data from db: var voltageValues = dt.Values.Where(v => v.FieldName == "Voltage").OrderBy(v => v.Datetime).ToList<Value>(); var currentValues = dt.Values.Where(v => v.FieldName == "Current").OrderBy(v => v.Datetime).ToList<Value>(); Highcharts Chart = new Highcharts("Chart"); // Initiizing chart // Making month and days persian, however it is not accurate at all! Chart.SetOptions(new GlobalOptions { Lang = new DotNet.Highcharts.Helpers.Lang { Loading = "در حال بارگذاری", Months = new string[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند" }, Weekdays = new string[] { "شنبه", "یک شنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنج شنبه", "جمعه" }, ShortMonths = new string[] { "فرور", "اردی", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند" } } }); Chart.InitChart(new Chart { DefaultSeriesType = ChartTypes.Line, MarginRight = 130, MarginBottom = 55, ClassName = "chart", ZoomType = ZoomTypes.X }) .SetTitle(new Title { Text = "نمودار تغییرات داده ها " }) .SetSubtitle(new Subtitle { Text = "نمونه استفاده نمودار", X = -20 }) .SetXAxis(new XAxis { Type = AxisTypes.Datetime, Title = new XAxisTitle { Text = "بازه زمانی از ... تا..." }, MinorTickInterval = 3600 * 1000, TickLength = 1, MinRange = 3600 * 1000, MinTickInterval = 3600 * 1000, GridLineWidth = 1, Labels = new XAxisLabels { Align = HorizontalAligns.Right, Rotation = -30, }, DateTimeLabelFormats = new DateTimeLabel { Second = "%H:%M:%S", Minute = "%H:%M", Hour = "%H:%M", Day = "%e %b", Week = "%e %b", Month = "%b", Year = "%Y", }, ShowEmpty = false, }) .SetLegend(new Legend { Layout = Layouts.Vertical, Align = HorizontalAligns.Left, X = 20, VerticalAlign = VerticalAligns.Top, Y = 80, BackgroundColor = new BackColorOrGradient(System.Drawing.ColorTranslator.FromHtml("#FFFFFF")) }); YAxis[] yAxis = new YAxis[2]; yAxis[0] = (new YAxis { Title = new YAxisTitle { Text = string.Format("{0} ({1})", "Voltage", "V"), }, Labels = new YAxisLabels { //Align = HorizontalAligns.Right, Formatter = "function() { return this.value; }", }, Opposite = true, GridLineWidth = 0 }); yAxis[1] = (new YAxis { Title = new YAxisTitle { Text = string.Format("{0} ({1})", "Current", "A"), }, Labels = new YAxisLabels { //Align = HorizontalAligns.Left, Formatter = "function() { return this.value; }", }, Opposite = false, GridLineWidth = 1 }); Chart.SetYAxis(yAxis); Series[] seriesOfData = new Series[2]; object[,] x1 = new object[voltageValues.Count(), 2]; for (int i = 0; i < voltageValues.Count(); i++) { x1[i, 0] = PersianDateTime.ParseFromDateTime(voltageValues[i].Datetime).ToString("Date.parse('MM/dd/yyyy HH:mm:ss')"); x1[i, 1] = voltageValues[i].Value1; } DotNet.Highcharts.Helpers.Data data1 = new DotNet.Highcharts.Helpers.Data(x1); Series series1 = new Series { Name = "Voltage", Data = data1, Type = ChartTypes.Line, }; series1.YAxis = "0"; seriesOfData[0] = series1; object[,] x2 = new object[currentValues.Count(), 2]; for (int i = 0; i < voltageValues.Count(); i++) { x2[i, 0] = PersianDateTime.ParseFromDateTime(voltageValues[i].Datetime).ToString("Date.parse('MM/dd/yyyy HH:mm:ss')"); x2[i, 1] = currentValues[i].Value1; } DotNet.Highcharts.Helpers.Data data2 = new DotNet.Highcharts.Helpers.Data(x2); Series series2 = new Series { Name = "Current", Data = data2, Type = ChartTypes.Spline, }; series1.YAxis = "1"; seriesOfData[1] = series2; Chart.SetSeries(seriesOfData); ViewBag.Chart = Chart; return View(); }
public ActionResult Graph(List<int> id) { if (id == null) id = new List<int> { Helper.GetAllAccounts().First().Id }; var chart = new Highcharts("spline") .InitChart(new Chart { DefaultSeriesType = ChartTypes.Line }) .SetTitle(new Title { Text = "График звонков" }) .SetSubtitle(new Subtitle { Text = "Месяц" }) .SetXAxis(new XAxis { Categories = new[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" } }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Длительность разговоров [сек]" } }) .SetTooltip(new Tooltip { Enabled = true, Formatter = @"function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; }" }) .SetPlotOptions(new PlotOptions { Line = new PlotOptionsLine { DataLabels = new PlotOptionsLineDataLabels { Enabled = true }, EnableMouseTracking = false } }); var dt = new List<Series>(); foreach (var acc in Helper.GetAccounts(id)) { var data = acc .Transactions.Where(r => r.CreateDate.Year == DateTime.Now.Year) .GroupBy(r => new { r.CreateDate.Month }) .Select(g => new { Date = g.Key.Month, Total = g.Sum(i => i.CallDuration) }).OrderBy(r => r.Date); var yAxisData = data.Select(i => new object[] {i.Total}).ToArray(); dt.Add(new Series { Name = acc.AccountCode, Data = new Data(yAxisData) }); } chart.SetSeries(dt.ToArray()); return View(chart); }
public ActionResult _SingleLine() { Series series = new Series { Data = new Data(new object[] { 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4 }) }; XAxis xaxis = new XAxis { Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } }; Highcharts chart = new Highcharts("chart_single_line"); chart.SetXAxis(xaxis); chart.SetSeries(series); return PartialView(new SmartCity.Models.Global.HighchartModel { highChart=chart }); }
public static Highcharts PieWithGradientFill(List<Catalog> catalogList) { Highcharts chart = new Highcharts("piechart") .InitChart(new Chart { PlotBackgroundColor = null, PlotBorderWidth = null, PlotShadow = false }) .SetTitle(new Title { Text = catalogList.Count>0 ? "Overview of Desktop Groups": string.Empty }) .SetTooltip(new Tooltip { Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed(2) +' %'; }" }) .SetPlotOptions(new PlotOptions { Pie = new PlotOptionsPie { AllowPointSelect = true, Cursor = Cursors.Pointer, DataLabels = new PlotOptionsPieDataLabels { Enabled = true, Color = System.Drawing.ColorTranslator.FromHtml("#000000"), ConnectorColor = System.Drawing.ColorTranslator.FromHtml("#000000"), Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.y +' desktops'; }" } } }); List<object> objList = new List<object>(); foreach (var cat in catalogList) { var tmp = new object[] { cat.Name, cat.Count }; objList.Add(tmp); } object[] dataArray = objList.ToArray(); chart.SetSeries(new Series { Type = ChartTypes.Pie, Name = "Browser share", Data = new Data(dataArray) //Data = new Data(new object[] // { // new object[] { "Office", 8 }, // new object[] { "Interns", 2}, // new object[] { "Developers", 2}, // }) }); return chart; }
private void GetAreaChart() { DashboardViewModel dashboard = new DashboardViewModel(); dashboard.ViewModelEvent += dashboard_ViewModelEvent; // Get statistics List<Dictionary<string, object>> values = dashboard.GetAreaChart(); if (values != null) { Highcharts areaChart = new Highcharts("areaChart"); areaChart.InitChart(new Chart() { DefaultSeriesType = ChartTypes.Area, BackgroundColor = new DotNet.Highcharts.Helpers.BackColorOrGradient(Color.Transparent), Height = 300 }); areaChart.SetPlotOptions(new PlotOptions() { Series = new PlotOptionsSeries() { ConnectNulls = true, ConnectEnds = true } }); areaChart.SetLegend(new DotNet.Highcharts.Options.Legend() { Align = DotNet.Highcharts.Enums.HorizontalAligns.Center, Layout = DotNet.Highcharts.Enums.Layouts.Horizontal, VerticalAlign = DotNet.Highcharts.Enums.VerticalAligns.Bottom, BorderWidth = 0 }); areaChart.SetCredits(new DotNet.Highcharts.Options.Credits() { Enabled = false }); areaChart.SetTitle(new DotNet.Highcharts.Options.Title() { Text = "" }); YAxis yAxis = new YAxis(); yAxis.Title = new DotNet.Highcharts.Options.YAxisTitle() { Text = "" }; yAxis.Min = 0; XAxis xAxis = new XAxis(); xAxis.Categories = values[0].Keys.ToArray(); List<Series> seriesCollection = new List<Series>(); Series seriesUsers = new Series(); seriesUsers.Data = new DotNet.Highcharts.Helpers.Data(values[0].Values.ToArray()); seriesUsers.Name = "Users"; seriesCollection.Add(seriesUsers); Series seriesMailbox = new Series(); seriesMailbox.Data = new DotNet.Highcharts.Helpers.Data(values[1].Values.ToArray()); seriesMailbox.Name = "Mailbox"; seriesCollection.Add(seriesMailbox); if (StaticSettings.CitrixEnabled) { Series seriesCitrix = new Series(); seriesCitrix.Data = new DotNet.Highcharts.Helpers.Data(values[2].Values.ToArray()); seriesCitrix.Name = "Citrix"; seriesCollection.Add(seriesCitrix); } areaChart.SetXAxis(xAxis); areaChart.SetYAxis(yAxis); areaChart.SetSeries(seriesCollection.ToArray()); litAreaChart.Text = areaChart.ToHtmlString(); } else litAreaChart.Text = "Error populating chart."; }
public string WeightYearProgressNet() { var startWeight = pedometerCalcService.GetStartWeight(DateTime.Now.Year); const int goalWeight = 144; var currentWeight = pedometerCalcService.GetRecentWeight(); var goalLoss = startWeight - goalWeight; var actualLoss = Math.Round(startWeight - currentWeight, 1); var expectedPct = (DateTime.Now.DayOfYear / 365.0); var expectedLoss = Math.Round(expectedPct * goalLoss, 1); var highchart = new Highcharts("weightloss"); var chart = new Chart() { Type = ChartTypes.Gauge }; highchart.InitChart(chart); highchart.SetTitle(new Title{Text = "Weight Loss " + Math.Round(currentWeight,1)}); var series = new Series {Data = new Data(new object[] {actualLoss})}; highchart.SetSeries(series); var pane = new Pane { Background = new[] { new BackgroundObject { InnerRadius = new PercentageOrPixel(60, true), OuterRadius = new PercentageOrPixel(100, true) } }, StartAngle = 0, EndAngle = 360 }; highchart.SetPane(pane); var yaxis = new YAxis { Min = 0, Max = goalLoss, PlotBands = new[] { new YAxisPlotBands { From = 0, To = expectedLoss, Color = Color.Red }, new YAxisPlotBands { From = expectedLoss, To = expectedLoss+0.7, Color = Color.Yellow }, new YAxisPlotBands { From = expectedLoss+0.7, To = goalLoss, Color = Color.Green } }, Labels = new YAxisLabels() { Style = "color:'black'"} }; highchart.SetYAxis(yaxis); highchart.SetTooltip(new Tooltip() {Enabled = false}); highchart.SetSubtitle(new Subtitle() { Text = string.Format("Actual: {0} | Expected: {1} | Difference: {2}", actualLoss, expectedLoss, actualLoss-expectedLoss) }); highchart.SetLegend(new Legend() {Enabled = false}); return highchart.ToHtmlString(); }
public void DriversIncome() { //var DriversInc = orderManager.GetDriversIncome(); Highcharts driversIncomeChart = new Highcharts("driversChartId"); driversIncomeChart.SetTitle(new Title() { Text = Resources.Resource.DriversIncome }); driversIncomeChart.SetXAxis(new XAxis() { Title = new XAxisTitle() { Text = @Resources.Resource.Drivers }, Categories = new string[] {Resources.Resource.Info} }); driversIncomeChart.SetYAxis(new YAxis() { Title = new YAxisTitle() { Text = @Resources.Resource.IncomeUAH }}); List<Series> series = new List<Series>(); List<object> serieData = new List<object>(); Series serie = new Series(); /*foreach (ChartsColumnDTO item in DriversInc) { serie = new Series(); serie.Name = item.ColumnName; serie.Type = ChartTypes.Column; serieData.Clear(); serieData.Add(new object[] { item.Value }); serie.Data = new Data(serieData.ToArray()); series.Add(serie); };*/ driversIncomeChart.SetSeries(series.ToArray()); driversIncomeChart.SetLegend(new Legend() { Align = HorizontalAligns.Right, Layout = Layouts.Vertical, VerticalAlign = VerticalAligns.Top }); driversIncomeChart.SetPlotOptions(new PlotOptions() { Area = new PlotOptionsArea() { Stacking = Stackings.Normal } }); driversIncomeChart.SetCredits(new Credits() { Enabled = false }); ViewBag.DriversIncomeChart = driversIncomeChart; }
private void DorinTewst() { Queue<string> categoriesQueue = new Queue<string>(new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }); for (int i = 0; i < DateTime.Now.Month; i++) { categoriesQueue.Enqueue(categoriesQueue.Dequeue()); } var categories = categoriesQueue.ToArray(); Highcharts chart = new Highcharts("FuelConsumptionID"); chart.SetTitle(new Title() { Text = Resources.Resource.FuelConsumDorin }); ///var list = orderManager.AnnualFuelConsumption(); List<object> obList = new List<object>(); /*foreach (var item in list) { var iut = (int)item; obList.Add((object)iut); }*/ chart.SetYAxis(new YAxis { Title = new YAxisTitle() { Text = Resources.Resource.FuleLDorin }, }); chart.SetXAxis(new XAxis { Title = new XAxisTitle() { Text = Resources.Resource.FuleMonthDorin }, Categories = categories }); List<Series> series = new List<Series>(); Series serie = new Series(); serie.Name = Resources.Resource.LetresDorin; serie.Type = ChartTypes.Column; //serie.Data = new Data(serieData.ToArray()); serie.Data = new Data(obList.ToArray()); series.Add(serie); chart.SetSeries(series.ToArray()); chart.SetLegend(new Legend() { Align = HorizontalAligns.Right, Layout = Layouts.Vertical, VerticalAlign = VerticalAligns.Top }); chart.SetPlotOptions(new PlotOptions() { Area = new PlotOptionsArea() { Stacking = Stackings.Normal } }); chart.SetCredits(new Credits() { Enabled = false }); ViewBag.Chart = chart; }
protected void Page_Load(object sender, EventArgs e) { var FASna = (List <string>)Session["AsName"]; var Frtta = (List <string>)Session["Rttave"]; List <int> Frttave = new List <int>(); int Rrtt11 = 0; foreach (var item in Frtta) { string Rrtttemp = item; char[] Rendchar = { ' ', 'm', 's' }; string Rtrimen = Rrtttemp.TrimEnd(Rendchar); Rrtt11 = Convert.ToInt16(Rtrimen); Frttave.Add(Rrtt11); } var g = FASna.GroupBy(i => i); int countLength = 0; foreach (var grp in g) { countLength++; } object[] data = new object[countLength]; int index = 0; foreach (var grp in g) { data[index] = new object[] { grp.Key, grp.Count() }; index++; } DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart").InitChart(new Chart { DefaultSeriesType = ChartTypes.Pie, PlotShadow = false }) .SetTitle(new Title { Text = "Province Based Institutions Registration" }) .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>: '+ Math.round(this.percentage) +' %'; }" }, } }) .SetSeries(new Series { Data = new Data(data) }); Literal1.Text = chart.ToHtmlString(); //////////////////// RTT //////////////////////// Series[] series = new Series[Frttave.Count()]; string[] array_DistrictNames = new string[Frttave.Count()]; data = new object[Frttave.Count()]; int index2 = 0; foreach (var district in Frttave) { series[index2] = new Series { Name = index2.ToString(), Data = new Data(new object[] { district }) }; array_DistrictNames[index2] = index2.ToString(); index2++; } DotNet.Highcharts.Highcharts chart2 = new DotNet.Highcharts.Highcharts("chart").InitChart(new Chart { DefaultSeriesType = ChartTypes.Column, Margin = new int[] { 50, 50, 100, 80 } }) .SetTitle(new Title { Text = "District Based Registered Institutes" }) .SetPlotOptions(new PlotOptions { Bar = new PlotOptionsBar { DataLabels = new PlotOptionsSeriesDataLabels { Enabled = true } } } ) .SetXAxis(new XAxis { Categories = new [] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" } }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Registered Institutions", Align = AxisTitleAligns.High } }) ; chart2.SetSeries(series); Literal2.Text = chart2.ToHtmlString(); }