Tutorial 47: Tornado chart sample
« on: February 05, 2016, 01:27:00 AM »
Steps:

1. Create a new Windows application project (C#) and name it Tutorial47_Tornado.
2. Add Crossing Charts Library to the toolbox pallete and drag it to Form1.
3. Copy and paste de following code:

Note: the code in the Form1_Load event could be used in ASP.NET applications as well.

Code: [Select]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrossingChartsLibrary;
namespace Tutorial47_Tornado
{
  public partial class Form1 : Form
  {
  public Form1()
  {
    InitializeComponent();
  }
  private void Form1_Load(object sender, EventArgs e)
  {
    // look & feel
    CrossingCharts1.Title = "Tornado Chart Sample";
    CrossingCharts1.Style = STYLE2D3D.STYLE2D_TORNADO;
    CrossingCharts1.YAxisScaleMode = SCALEMODE.SCALEMODE_FIXED;
    CrossingCharts1.YAxisScaleMaximum = 15;
    CrossingCharts1.YAxisScaleMinimum = 0;
    CrossingCharts1.YAxisLabelsRotated = true;
    CrossingCharts1.ShowDividersX = true;
    CrossingCharts1.ShowValues = false;
    // group descriptions
    String[] itemsLegend = new String[15];
    for (int k = 1; k <= 15; k++) { itemsLegend[k - 1] = "Group " + k; }
    CrossingCharts1.ItemsLegend = itemsLegend;
    CrossingCharts1.XAxisLabelsRotated90 = true;
    CrossingCharts1.ShowXAxis = true;
    // legend & datatable
    CrossingCharts1.LegendAlignment = STYLEALIGNMENT.STYLEALIGNMENT_TOP_CENTER;
    CrossingCharts1.LegendText = "Sections";
    String[] seriesLegend = new String[] { "Section 1", "Section 2" };
    CrossingCharts1.SeriesLegend = seriesLegend;
    CrossingCharts1.DataTableText = "Data";
    CrossingCharts1.DataTableFont = new Font("Tahoma", 10);
    CrossingCharts1.ShowItemsLegend = true;
    CrossingCharts1.ShowLegendInDataTable = true;
    // data
    SeriesFactory sf = new SeriesFactory();
    Random rnd = new Random();
    for (int k = 0; k < 8; k++)
    {
      sf.AddValue(rnd.Next(15));
    }
    sf.NewSerie();
    for (int k = 0; k < 8; k++)
    {
      sf.AddValue(rnd.Next(15));
    }
    sf.ApplyTo(CrossingCharts1);
  }
}
}

Results:
« Last Edit: February 17, 2016, 07:43:53 AM by CrossingCharts »