Gallery
JS Stacked Sales Bars
<%@ Page Language="C#" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
// This sample demonstrates a stacked bar chart with firstPoint labels.
// Set he chart size.
Chart.Width = 850;
Chart.Height = 400;
// Set the title.
Chart.TitleBox.Label.Text="Worldwide PC Vendor Unit Shipment (Thousands of Units)";
Chart.TitleBox.Label.Font = new Font("Arial", 12, FontStyle.Regular);
Chart.Debug = false;
Chart.DefaultElement.ToolTip = "%SeriesName (%Name)<br> %YValue"; Chart.Type = ChartType.ComboHorizontal;
Chart.ChartArea.ClearColors();
Chart.LegendBox.Visible = false;
Chart.Palette = new Color[] { ColorTranslator.FromHtml("#9fa8da"), ColorTranslator.FromHtml("#f48fb1"), ColorTranslator.FromHtml("#ffab91"), ColorTranslator.FromHtml("#ffe082"), ColorTranslator.FromHtml("#c5e1a5"), ColorTranslator.FromHtml("#80cbc4"), ColorTranslator.FromHtml("#81d4fa")};
// Set the directory where the related JSC files will be created and stored.
Chart.TempDirectory="temp";
// Enable JSCharting
Chart.JS.Enabled = true;
Chart.JS.Buttons.EnableExportButton = false;
Chart.JS.Buttons.EnablePrintButton = false;
Chart.JS.Settings.Add("defaultSeries_firstPoint.label_text", "%seriesName");
Chart.XAxis.Scale = Scale.Stacked;
Chart.XAxis.DefaultTick.GridLine.Color = Color.LightGray;
DataEngine de = new DataEngine();
de.ChartObject = Chart; // Necessary to view any errors the dataEngine may throw.
de.Data = "./../../data/resources/PCSales.csv";
de.DataFields = "yAxis=sales,name=date,splitBy=vendor";//cvs must have header
SeriesCollection sc = de.GetSeries();
Chart.SeriesCollection.Add(sc);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Gallery Sample</title></head>
<body>
<div align="center">
<dotnet:Chart id="Chart" runat="server"/>
</div>
</body>
</html>
<%@ Page Language="vb" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' This sample demonstrates a stacked bar chart with firstPoint labels.
' Set he chart size.
Chart.Width = 850
Chart.Height = 400
' Set the title.
Chart.TitleBox.Label.Text="Worldwide PC Vendor Unit Shipment (Thousands of Units)"
Chart.TitleBox.Label.Font = New Font("Arial", 12, FontStyle.Regular)
Chart.Debug = False
Chart.DefaultElement.ToolTip = "%SeriesName (%Name)<br> %YValue"
Chart.Type = ChartType.ComboHorizontal
Chart.ChartArea.ClearColors()
Chart.LegendBox.Visible = False
Chart.Palette = New Color() { ColorTranslator.FromHtml("#9fa8da"), ColorTranslator.FromHtml("#f48fb1"), ColorTranslator.FromHtml("#ffab91"), ColorTranslator.FromHtml("#ffe082"), ColorTranslator.FromHtml("#c5e1a5"), ColorTranslator.FromHtml("#80cbc4"), ColorTranslator.FromHtml("#81d4fa")}
' Set the directory where the related JSC files will be created and stored.
Chart.TempDirectory="temp"
' Enable JSCharting
Chart.JS.Enabled = True
Chart.JS.Buttons.EnableExportButton = False
Chart.JS.Buttons.EnablePrintButton = False
Chart.JS.Settings.Add("defaultSeries_firstPoint.label_text", "%seriesName")
Chart.XAxis.Scale = Scale.Stacked
Chart.XAxis.DefaultTick.GridLine.Color = Color.LightGray
Dim de As DataEngine = New DataEngine()
de.ChartObject = Chart ' Necessary to view any errors the dataEngine may throw.
de.Data = "./../../data/resources/PCSales.csv"
de.DataFields = "yAxis=sales,name=date,splitBy=vendor" 'cvs must have header
Dim sc As SeriesCollection = de.GetSeries()
Chart.SeriesCollection.Add(sc)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Gallery Sample</title></head>
<body>
<div align="center">
<dotnet:Chart id="Chart" runat="server"/>
</div>
</body>
</html>
- Sample FilenameJsStackedSalesBars.aspx
- Version10.0
- Uses DatabaseNo