jQuery Flot Bindings
  
    
    
      
        Namespace
      
      
        WebExtras.JQFlot
      
     
   
  
    
      Dependancies
    
    
      
        - Appropriate third party libraries
 
        - webextras.bootstrap3.css
 
      
     
   
 
  
    Steps involved in creating a Flot graph
    
      - Creating the graph options
 
      - Creating graph data
 
      - Creating the graph series
 
      - Rendering the graph
 
    
   
 
  Creating the Flot options
  Flot graph options are created by instantiating the 
WebExtras.JQFlot.FlotOptions class.
  
  FlotOptions options = new FlotOptions
  {
    xaxis = new AxisOptions(),                  
    yaxis = new AxisOptions(),                  
    grid = new GridOptions { borderWidth = 1 }  
  };
  
 
  Creating the graph data
  Flot rendering data is a 2 dimensional numeric array. This can be of any numeric type 
int, decimal, float or
  double. In order to compensate for numerals WebExtras uses the biggest of the numeral types provided by .NET - 
  
double
  
  List<double[]> graphData = new List<double[]>();
  
  
  
  graphData.Add(new double[] { 1, 5 });                            
  graphData.Add(new double[] { 2, 10 });
  
  
 
  Creating the Flot series to be plotted
  A Flot series is creating by instantiating the 
WebExtras.JQFlot.FlotSeries class
  
  FlotSeries linegraph = new FlotSeries
  {
    label = "Sample Line Graph",
    data = graphData,
    lines = new LineGraph { show = true }                 
  };
  
 
  Creating the Flot Chart
  All the things we have done so far now get bundled into a Flot chart by instantiating the 
WebExtras.JQFlot.FlotChart object.
  
  
  FlotChart chart = new FlotChart
  {
    chartOptions = options,
    chartSeries = new FlotSeries[] { linegraph }          
  };
  
 
  Now in your HTML
  Now that all C# bindings are done, it is time to render our graph. This can be done with a little bit of Javascript.
  
    
  $.plot($('#line-graph'), [chart.chartSeries[0].ToString()], chart.chartOptions.ToString());
  
 
  And finally the output...