ChartWidget Class |
Namespace: Dynamicweb.Dashboards.Widgets
The ChartWidget type exposes the following members.
Name | Description | |
---|---|---|
ChartWidget |
The chart widget default constructor
|
Name | Description | |
---|---|---|
ChartType |
Gets or sets chart presentation type
| |
Color |
Gets or sets chart color
| |
Columns |
Gets or sets widget size
(Inherited from DashboardWidget.) | |
CreatedDate |
Gets the created date and time.
(Inherited from DashboardWidget.) | |
CssClass |
Gets or sets css class
| |
Element |
The to be shown
(Inherited from DashboardElementWidget.) | |
Id |
Gets widget Id
(Inherited from DashboardWidget.) | |
InstantFetch |
Gets or sets value indicating whether data should be fetch to widget instantly, otherwise - using ajax
| |
ModifiedDate |
Gets the last modified date and time.
(Inherited from DashboardWidget.) | |
Order |
Gets or sets widget order
(Inherited from DashboardWidget.) | |
Presentation |
Gets or sets chart presentation
| |
ShowTitle |
Gets or sets value indicating whether to show widget title.
(Inherited from DashboardWidget.) | |
Title |
Gets or sets widget title
(Inherited from DashboardWidget.) | |
TitleAction |
Gets or sets widget title action
(Inherited from DashboardWidget.) |
Name | Description | |
---|---|---|
Fetch |
Fetches widget with data
(Overrides DashboardWidgetFetch(IDashboard, String).) | |
GetData |
Gets chart data
| |
GetIdSuitableString | (Inherited from ConfigurableAddIn.) | |
GetOptions |
Return dropdown options
(Overrides DashboardWidgetGetOptions(String).) | |
GetParametersToXml | (Inherited from ConfigurableAddIn.) | |
GetParametersToXml(Boolean) | (Inherited from ConfigurableAddIn.) | |
LoadParametersFromXml | (Inherited from ConfigurableAddIn.) | |
Render |
The method render widget and return html
(Inherited from DashboardElementWidget.) | |
RenderAdditionalContent | (Inherited from ConfigurableAddIn.) | |
ScriptDependencies |
Specifies relative paths to all script files that this widget is dependent upon.
(Inherited from DashboardWidget.) | |
SetValue | (Inherited from ConfigurableAddIn.) | |
StylesheetDependencies |
Specifies relative paths to all style files that this widget is dependent upon.
(Inherited from DashboardWidget.) | |
UpdateFromPost | (Inherited from ConfigurableAddIn.) |
using System; using System.Collections; using System.Collections.Generic; using Dynamicweb.Dashboards.Widgets; using Dynamicweb.UI.Elements.Displays.Charts; using Dynamicweb.Extensibility.AddIns; using Dynamicweb.Extensibility.Editors; namespace Dynamicweb.Dashboards.Examples { [AddInName("Simple multi-series chart")] [AddInDescription("Show simple chart with 2 series")] [AddInIcon(Core.UI.Icons.KnownIcon.LineChart)] public sealed class SimpleChartWidget : ChartWidget { /// <summary> /// Gets or sets chart legend position /// </summary> [AddInLabel("Legend position"), AddInParameter("LegendPosition"), AddInParameterEditor(typeof(DropDownParameterEditor), "none=false;container=body")] public string LegendPosition { get; set; } public SimpleChartWidget() { Title = "Total cities population"; ChartType = ChartType.Line; InstantFetch = true; } public override ChartData GetData(IDashboard dashboard, string path) { var series = new List<double[]> { new double[] { 500d, 200d, 150d, 300d }, new double[] { 300d, 400d, 250d, 100d } }; var data = new ChartData { Labels = new[] { "London", "New York", "Moscow", "Copenhagen" }, MultiSeries = series, Legends = new[] { "Man", "Woman" }, LegendPosition = LegendPosition //(LegendPosition)Enum.Parse(typeof(LegendPosition), LegendPosition) }; return data; } /// <summary> /// Return dropdown options /// </summary> /// <param name="dropdownName"></param> /// <returns></returns> public override Hashtable GetOptions(string dropdownName) { var hash = base.GetOptions(dropdownName) ?? new Hashtable(); if ("LegendPosition".Equals(dropdownName, StringComparison.OrdinalIgnoreCase)) { hash.Add("top", "Top"); hash.Add("right", "Right"); hash.Add("bottom", "Bottom"); hash.Add("left", "Left"); } return hash; } } }