StepArea Chart

StepArea graphs are very similar to the regular area chart, except that instead of a straight line, all values are connected by continuous vertical and horizontal lines forming a step. This type of chart is useful when you need to show what extent values have changed for different points in the same series.

step-area-graph

The chart from the image above is created with the following code:

<shield:ShieldChart ID="ShieldChart1" Width="100%" Height="400px" runat="server" 
    OnTakeDataSource="ShieldChart1_TakeDataSource"
    CssClass="chart">
    <PrimaryHeader Text="Site Usage Statistics"></PrimaryHeader>
    <Axes>
        <shield:ChartAxisX  AxisType="Datetime" FixedEnd="false"></shield:ChartAxisX>
        <shield:ChartAxisY EndOffset="0">
        </shield:ChartAxisY>
    </Axes>
    <DataSeries>
        <shield:ChartStepAreaSeries CollectionAlias="Site1" DataFieldY="Site1Value">
        </shield:ChartStepAreaSeries>
        <shield:ChartStepAreaSeries CollectionAlias="Site2" DataFieldY="Site2Value">
        </shield:ChartStepAreaSeries>
    </DataSeries>
</shield:ShieldChart>
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);

    (ShieldChart1.DataSeries[0] as Shield.Web.UI.ChartStepAreaSeries).DataStart = (decimal)(new DateTime(2010, 1, 1) -
        new DateTime(1970, 1, 1).ToUniversalTime()).TotalMilliseconds;
    (ShieldChart1.DataSeries[0] as Shield.Web.UI.ChartStepAreaSeries).DataStep = 24 * 3600 * 1000;

    (ShieldChart1.DataSeries[1] as Shield.Web.UI.ChartStepAreaSeries).DataStart = (decimal)(new DateTime(2010, 1, 1) -
        new DateTime(1970, 1, 1).ToUniversalTime()).TotalMilliseconds;
    (ShieldChart1.DataSeries[1] as Shield.Web.UI.ChartStepAreaSeries).DataStep = 24 * 3600 * 1000;
}

protected void ShieldChart1_TakeDataSource(object sender, Shield.Web.UI.ChartTakeDataSourceEventArgs e)
{
    List datasource = new List() 
    { 
        new ExampleData() { Site1Value = 29.9, Site2Value=20.9},
        new ExampleData() { Site1Value = 71.5, Site2Value= 31.5},
        new ExampleData() { Site1Value = 106.4, Site2Value= 98.4 },
        new ExampleData() { Site1Value = 129.2, Site2Value= 101.2},
        new ExampleData() { Site1Value = 144.0, Site2Value= 104.0},
        new ExampleData() { Site1Value = 176.0, Site2Value= 26.0},
        new ExampleData() { Site1Value = 135.6, Site2Value= 105.6},
        new ExampleData() { Site1Value = 148.5, Site2Value= 48.5},
        new ExampleData() { Site1Value = 216.4, Site2Value= 206.4 },
        new ExampleData() { Site1Value = 194.1, Site2Value= 114.1 },
        new ExampleData() { Site1Value = 195.6, Site2Value= 145.6 },
        new ExampleData() { Site1Value = 154.4, Site2Value= 164.4 },
        new ExampleData() { Site1Value = 145, Site2Value= 175 },
        new ExampleData() { Site1Value = 133, Site2Value= 103 }, 
        new ExampleData() { Site1Value = 145, Site2Value= 115 }, 
        new ExampleData() { Site1Value = 127, Site2Value= 107 }
    };

    ShieldChart1.DataSource = datasource;
}

private class ExampleData
{
    public double Site1Value { get; set; }
    public double Site2Value { get; set; }            
}   
  • When the chart is bound to collection of objects the X values are got by the field which name is set into the DataFieldX property of the ChartStepAreaSeries. The Y values are got by the field which name is set into the DataFieldY property.
  • The name that is shown in the legend is chosen via the CollectionAlias property of the ChartStepAreaSeries.
  • By default all X values are sorted in order area chart to be shown appropriately, however this behavior is controlled by the EnableValueXSorting property of the ChartStepAreaSeries.
  • DataStart and DataStep properties control the start value of the x axis and explicit value for the interval between a data series member values.
  • All points from the ChartStepAreaSeries are represented with ChartSeriesItem which belongs to the ChartStepAreaSeries.Items collection.
    • The ChartStepAreaSeries.Items can be added declarative without data binding.
    • The data binding and declarative approach can be mixed. However in order declarative items to be appended to the items created from the datasource the ShieldChart.AppendDataBoundItems property need to be set to "true".
  • All setting related to ChartStepAreaSeries are contained into the ChartStepAreaSeries.Settings object.
    • The background and line color can be set via Color and InnerColor properties.
    • If the AddToLegend is set to false the series is not added into the legend.
    • The animation of the series can be controlled by ChartStepAreaSeries.Settings.EnableAnimation and ChartStepAreaSeries.Settings.AnimationDuration properties.
    • If some values are missing (i.e. they are null/Nothing) from the series data you can have the chart work around this by setting the DrawNullValues property.
    • The series of multiline area chart can be stacked by setting the StackMode property to Normal or Percent.
    • Each point from the series can be selected if the EnablePointSelection property is set to true.
    • All selected points can be customized by Settings.PointMark.ActiveSettings.PointSelectedState object properties.
    • Each series has related tooltip which can be customized via the Settings.Tooltip object.
    • Each point from the series can have related text, which appearance is controlled by Settings.DataPointText property. You can changeBackgroundColor, BorderColor, Color, Padding, and TextAngle of the corresponding data point text.