score:2
Accepted answer
Just create a model that holds a List<HighChart>
(or add it to your existing model). Something like:
public class ChartsModel
{
public List<HighChart> Charts { get; set; }
}
Then you can populate the model and send it to the view in your action method, like so:
ChartsModel model = new ChartsModel();
model.Charts = new List<HighChart>();
HighCharts g1 = new HighCharts("chart");
HighCharts g2 = new HighCharts("chart");
model.Charts.Add(g1);
model.Charts.Add(g2);
return View(model);
Then in your view, you can loop round each chart:
@model ChartsModel
@foreach (HighCharts chart in Model.Charts)
{
@* do your stuff *@
}
score:2
If you're only adding two charts you dont need a List.. Just declare in your class for the typed view:
public class ChartsModel
{
public Highcharts Chart1 { get; set; }
public Highcharts Chart2 { get; set; }
}
Then your view put @(Model.Chart1) and @(Model.Chart2) where you want...
Important: Charts need diferent names, so in your controller, when you're creating the charts:
HighCharts g1 = new HighCharts("chart1"){ // Note the names
// definitions
};
HighCharts g2 = new HighCharts("chart2"){
// definitions
};
ChartsModel model = new ChartsModel();
model.Chart1 = g1;
model.Chart2 = g2;
return View(model);
Source: stackoverflow.com
Related Query
- Highcharts multiple charts on a single page using c# asp.net mvc3
- Using multiple Highcharts in a single page
- how to render multiple line charts - highcharts on same page using highcharts react wrapper - highcharts-react-offical
- drilldown maps and funnell charts on the same page using highcharts
- Cannot display multiple Highcharts on a single page
- Multiple highcharts charts dynamically created in angular2 on one page
- How to generate single PDF of page that contained multiple highcharts in DIVs
- How to show multiple pie charts using highcharts
- How to make multiple charts using highcharts in a loop?
- Charts using Highcharts with multiple series from JSON
- Adding multiple series to the spline chart using dotnet high charts in asp.net mvc3
- Using Highcharts to show multiple stacked bar charts next to each other
- Highcharts - Multiple Charts On Mobile Page
- HTML table as data source for highstock charts using highcharts
- Highcharts - how to display multiple graphs on one page using multiple xml files
- Highcharts charts on a page not rendering correctly when output to PDF using wkhtmltopdf
- How to create a drilleable bar graph in jsp page using open source charts API
- Displaying multiple graphs on one page using lazy high charts
- Multiple Charts on single page RAZOR MVC4
- Why code of Horizonal line(y-axis) on a single in Highcharts get applied to all other charts integrated with Webdatarocks
- javascript display multiple Highcharts using single function
- Behavior of multiple HighCharts on single page when removing one div
- How to update the HighCharts title using drill-up when there are multiple charts on same page?
- multiple charts using highcharts
- How do I set multiple unique charts in their own DIVs using an AngularJS directive and Highcharts
- Manage multiple highchart charts in a single webpage
- Highcharts Error #16: charts not showing on the same page
- Javascript Highcharts v3.0.5 - How to hide Y Axis Title when using multiple Y Axis
- Using HighCharts and DotNet.HighCharts to "Play" Multiple Series
- Highcharts - multiple charts
More Query from same tag
- It's not possible load Highstock from the CDN as an AMD module
- Parsing CSV data into JS Objects to use in chart. Uncaught ReferenceError: data is not defined(jsfiddle included)
- Highcharts - Column Chart: Compare corresponding values to change color
- Highcharts using JSON - graph not displaying mysql data
- Highcharts renders the chart as solid black and missing 'fill' attribute on `rect`
- Changing Highcharts data series type dynamically
- HighCharts Hide Series Name from the Legend
- How do I make highcharter use colorIndex number from tidy dataframe
- Displaying percentage in Y-axis of Highcharts column chart
- Prevent redraw of highchart when fetching data using ajax call
- Highchart - add "onclick event" for total value stackLabel
- Highcharts sankey diagram node rearrangement
- HighCharts onclick this.point.name is undefined
- Highcharts chart going blank on compare : 'percent' and type: 'arearange'
- How to hide specific dots and labels onmouseover in highcharts
- xAxis event do not call the callback function
- How can i change the color of a tile which was clicked of a treemap in highcharts using react
- I was trouble bubble value in highcharts .How to show by default value in series
- Highcharts 3D funnel Array format
- How to set the static series name to the element result based on the categories in the HighChart
- HighStock HighCharts Setting Flag on Click Event
- How to insert json within an array into highcharts?
- Convert DataTable to array for highcharts
- Highcharts: How to push the categories to the side?
- Highcharts Progress Bar Chart
- How to add secondary y-axis to highcharts
- Group specific points to categories in Highchart
- How to show values in Highcharts tooltip other than x and y when data points are too high?
- Highcharts: Syncing axis ticks across Multiple Charts
- Highchart - Activity guage display lable and lagends