Siticone Advanced Line Chart
The SiticoneAdvancedLineChart is a high-performance, multi-series visualization control designed for WinForms.
It features smooth Bézier curves, gradient fills, interactive zooming/panning, and advanced tooltips to render complex data sets beautifully and efficiently.
Data Binding
Properties and methods for connecting data sources to the chart.
| Property / Method | Type | Description & Usage Example |
|---|---|---|
DataSource |
object |
chart.DataSource = myDataSet;
The primary data source. Supports DataTable, DataSet, DataView, and IEnumerable.
|
BindToDataTable() |
void | chart.BindToDataTable(dt, "DateCol", new[]{"Val1", "Val2"}); Manually binds a DataTable using specific column names for X and multiple Y series. |
BindStringDataTable() |
void | chart.BindStringDataTable(dt, "Date", "Value", "Category"); Binds data where series are defined by string values in a column (e.g., pivoting "Category" column into multiple lines). |
DataBind() |
void |
chart.DataBind();
Explicitly forces the chart to process the assigned DataSource and render the series.
|
Appearance & Styling
Customize the visual presentation of the plot area, lines, and gradients.
| Property | Type | Description & Usage Example |
|---|---|---|
DefaultUseCurvedLines |
bool | chart.DefaultUseCurvedLines = true; If true, renders series using smooth Bézier curves instead of straight lines by default. |
DefaultLineStyle |
SiticoneLineChartLineStyle | chart.DefaultLineStyle = SiticoneLineChartLineStyle.Dash; Sets the default dash pattern (Solid, Dash, Dot, etc.) for new series. |
UseGradientBackground |
bool | chart.UseGradientBackground = true; Enables a gradient fill for the main control background. |
PlotAreaBackColor |
Color | chart.PlotAreaBackColor = Color.WhiteSmoke; The background color specific to the data plotting area. |
RoundedCorners |
bool | chart.RoundedCorners = true; Applies rounded edges to the plot area and legend box. |
ShadowDepth |
float | chart.ShadowDepth = 3f; Adds a drop shadow behind the plot area for depth. Set to 0 to disable. |
Axis Configuration
Manage the behavior and styling of the X and Y axes via the XAxis and YAxis properties.
| Property | Type | Description & Usage Example |
|---|---|---|
AutoScaleAxes |
bool | chart.AutoScaleAxes = true; Automatically calculates Minimum and Maximum values for axes based on the data points. |
XAxis.Title |
string | chart.XAxis.Title = "Time (Months)"; The text label displayed below the X-Axis. |
YAxis.ShowGrid |
bool | chart.YAxis.ShowGrid = true; Toggles the horizontal grid lines originating from the Y-axis. |
XAxis.IsDateTimeAxis |
bool | chart.XAxis.IsDateTimeAxis = true; Treats X values as OLE Automation Dates and formats labels as dates. |
Interaction & Tooltips
Features that allow users to explore the data dynamically.
| Property | Type | Description & Usage Example |
|---|---|---|
EnableZooming |
bool |
chart.EnableZooming = true;
Allows users to programmatically zoom into specific data ranges via ZoomTo().
|
EnablePointHighlight |
bool | chart.EnablePointHighlight = true; Draws a circle marker over the data point closest to the mouse cursor. |
ShowAdvancedToolTip |
bool | chart.ShowAdvancedToolTip = true; Displays a rich tooltip containing values for all series at the specific X-coordinate hovered. |
ToolTipFormat |
string | chart.ToolTipFormat = "{0}: {2}"; Format string for standard tooltips. {0}=Series, {1}=X, {2}=Y, {3}=Label. |
Methods
// Adds a new series to the chart programmatically.
// Returns the created AdvancedLineDataSeries object for further configuration.
var salesSeries = chart.AddSeries(
"Total Sales",
Color.SeaGreen,
SiticoneLineChartLineStyle.Solid,
true // Use curved lines
);
// Add points to the returned series
salesSeries.Points.Add(new AdvancedLineDataPoint(1, 150));
salesSeries.Points.Add(new AdvancedLineDataPoint(2, 230));
// Zooms the viewport to a specific range of X and Y values.
// Parameters: xMin, xMax, yMin, yMax
chart.ZoomTo(0, 50, 100, 500);
// Restores the view to show all data points.
chart.ResetZoom();
Events
Respond to user actions and internal state changes.
// 1. AdvancedLineDataPointClick Event
// Fires when a specific data point marker is clicked by the user.
chart.AdvancedLineDataPointClick += (s, e) =>
{
MessageBox.Show($"Clicked {e.Series.Name}: ({e.AdvancedLineDataPoint.XValue}, {e.AdvancedLineDataPoint.YValue})");
};
// 2. ZoomChanged Event
// Fires when the zoom level is modified via ZoomTo() or ResetZoom().
chart.ZoomChanged += (s, e) =>
{
Debug.WriteLine($"New X Range: {e.CurrentXRange.Minimum} to {e.CurrentXRange.Maximum}");
};
// 3. AxisRangeChanged Event
// Fires when axes are automatically scaled or manually adjusted.
chart.AxisRangeChanged += (s, e) =>
{
if (e.Axis.Orientation == AxisOrientation.Vertical)
Debug.WriteLine("Y Axis rescaled.");
};
Detailed Usage Examples
Example 1: Basic List Binding
Manually populating a chart using simple List data.
private void LoadBasicChart()
{
// 1. Clear existing data
lineChart.ClearSeries();
// 2. Add a new series
var series = lineChart.AddSeries("Growth", Color.SeaGreen);
series.UseCurvedLine = true;
series.LineThickness = 3f;
// 3. Enable Gradient Fill under the line
series.UseFillGradient = true;
series.FillGradientStart = Color.FromArgb(100, Color.SeaGreen);
series.FillGradientEnd = Color.FromArgb(0, Color.SeaGreen);
// 4. Add Points
series.Points.Add(new AdvancedLineDataPoint(1, 10));
series.Points.Add(new AdvancedLineDataPoint(2, 45));
series.Points.Add(new AdvancedLineDataPoint(3, 25));
series.Points.Add(new AdvancedLineDataPoint(4, 80));
// 5. Configure Visuals
lineChart.Title = "Annual Growth";
lineChart.AnimateOnStartup = true;
lineChart.AnimationType = SiticoneLineChartAnimationType.SlideInFromLeft;
}
Example 2: Binding to DataTable
Binding multiple series (e.g., Revenue and Expenses) from a single DataTable.
private void BindFinancialData()
{
DataTable dt = new DataTable();
dt.Columns.Add("Year", typeof(int));
dt.Columns.Add("Revenue", typeof(double));
dt.Columns.Add("Expenses", typeof(double));
dt.Rows.Add(2020, 50000, 30000);
dt.Rows.Add(2021, 65000, 35000);
dt.Rows.Add(2022, 80000, 40000);
// Configure Axes
lineChart.XAxis.Title = "Year";
lineChart.YAxis.Title = "Amount ($)";
lineChart.ForceIntegerScale = true; // Prevent years like 2020.5
// Bind: X Column = "Year", Y Columns = "Revenue" and "Expenses"
lineChart.BindToDataTable(dt, "Year", new[] { "Revenue", "Expenses" });
// Chart automatically creates 2 series with default colors
}
Example 3: Styling for Dashboard
Creating a modern, dark-themed dashboard chart with glow effects and custom markers.
private void ApplyDashboardStyle()
{
// Background & Plot Area
lineChart.BackColor = Color.FromArgb(30, 30, 30);
lineChart.PlotAreaBackColor = Color.FromArgb(40, 40, 40);
lineChart.PlotAreaBorderColor = Color.Gray;
lineChart.RoundedCorners = true;
lineChart.ShadowDepth = 5;
// Text Styling
lineChart.TitleColor = Color.White;
lineChart.LegendBackColor = Color.FromArgb(40, 40, 40);
lineChart.LegendFont = new Font("Segoe UI", 9f, FontStyle.Bold);
// Axis Styling
lineChart.XAxis.LabelColor = Color.LightGray;
lineChart.XAxis.GridColor = Color.FromArgb(60, 60, 60);
lineChart.YAxis.LabelColor = Color.LightGray;
lineChart.YAxis.GridColor = Color.FromArgb(60, 60, 60);
// Interaction
lineChart.EnablePointHighlight = true;
lineChart.PointHighlightColor = Color.Cyan;
lineChart.PointHighlightSize = 12;
lineChart.ShowAdvancedToolTip = true;
lineChart.ToolTipBackColor = Color.Black;
lineChart.ToolTipForeColor = Color.White;
}
Enumerations
public enum SiticoneLineChartLineStyle
{
Solid,
Dash,
Dot,
DashDot,
// ... includes specialized patterns like:
HeartBeat,
ZigZag,
CircuitBoard,
Barcode
}
public enum SiticoneLineChartAnimationType
{
None,
FadeIn,
SlideInFromLeft,
SlideInFromRight,
SlideInFromTop,
SlideInFromBottom,
ProgressiveDraw // Draws line point-by-point
}