Class ChartWidgetBase
- Namespace
- Dynamicweb.Dashboard.Widgets
- Assembly
- Dynamicweb.Core.dll
The class ChartWidget provides base chart dashboard widget
public abstract class ChartWidgetBase : DashboardWidget, IParameterOptions
- Inheritance
-
ChartWidgetBase
- Implements
- Derived
- Inherited Members
Examples
using Dynamicweb.Dashboard.Data;
using Dynamicweb.Dashboard.Widgets;
using Dynamicweb.Extensibility.AddIns;
using System.Collections.Generic;
namespace Dynamicweb.Dashboard.Examples;
[AddInName("Simple multi-series chart")]
[AddInDescription("Show simple chart with 2 series")]
[AddInIcon(Core.UI.Icons.KnownIcon.LineChart)]
public sealed class SimpleChartWidget : ChartWidgetBase
{
public SimpleChartWidget()
{
Title = "Total cities population";
ChartType = ChartType.Line;
}
public override ChartData GetData(IDashboard dashboard, string path)
{
var series = new List<double[]>
{
new double[] { 500, 200, 150, 300 },
new double[] { 300, 400, 250, 100 }
};
return new()
{
Labels = new[] { "London", "New York", "Moscow", "Copenhagen" },
MultiData = series,
Legends = new[] { "Man", "Woman" }
};
}
}
Constructors
ChartWidgetBase()
The chart widget default constructor
protected ChartWidgetBase()
Properties
ChartType
Gets or sets chart presentation type
public virtual ChartType ChartType { get; set; }
Property Value
Color
Gets or sets chart color
[AddInLabel("Color")]
[AddInParameter("ColorParameterEditor")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "")]
public virtual string Color { get; set; }
Property Value
Presentation
Gets or sets chart presentation
[AddInLabel("Type")]
[AddInParameter("PresentationParameterEditor")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "none=false;container=body")]
public virtual string Presentation { get; set; }
Property Value
Remarks
This property is string representation ofChartType with get ChartType.ToString() and set using Enum.TryParse.
Methods
GetData(IDashboard, string)
public virtual ChartData? GetData(IDashboard dashboard, string path)
Parameters
dashboardIDashboardpathstring
Returns
GetParameterOptions(string)
Gets parameteroptions
public override IEnumerable<ParameterOption> GetParameterOptions(string parameterName)
Parameters
parameterNamestring