From d8048547b1aa2db4a6ad6eb74bfcc377bb5f3c28 Mon Sep 17 00:00:00 2001
From: Brian Lagunas <835562+brianlagunas@users.noreply.github.com>
Date: Wed, 4 Dec 2024 13:36:11 -0700
Subject: [PATCH] simplified sample
---
e2e/Sandbox/App.config | 15 +
.../CampaignsDashboard.cs | 8 +-
.../CustomDashboard.cs | 628 +++++++++---------
.../DashboardLinkingDashboard.cs | 8 +-
.../HealthcareDashboard.cs | 8 +-
.../DashboardCreators/IDashboardCreator.cs | 10 +
.../ManufacturingDashboard.cs | 8 +-
.../MarketingDashboard.cs | 8 +-
.../RestDataSourceDashboard.cs} | 128 ++--
.../SalesDashboard.cs | 8 +-
.../SqlServerDataSourceDashboards.cs | 139 ++--
e2e/Sandbox/Helpers/DashboardFileNames.cs | 12 -
e2e/Sandbox/MainWindow.xaml | 2 +-
e2e/Sandbox/MainWindow.xaml.cs | 86 ++-
e2e/Sandbox/Properties/Settings.Designer.cs | 38 ++
e2e/Sandbox/Properties/Settings.settings | 9 +
e2e/Sandbox/Sandbox.csproj | 12 +
17 files changed, 605 insertions(+), 522 deletions(-)
create mode 100644 e2e/Sandbox/App.config
rename e2e/Sandbox/{Factories => DashboardCreators}/CampaignsDashboard.cs (97%)
rename e2e/Sandbox/{Factories => DashboardCreators}/CustomDashboard.cs (97%)
rename e2e/Sandbox/{Factories => DashboardCreators}/DashboardLinkingDashboard.cs (92%)
rename e2e/Sandbox/{Factories => DashboardCreators}/HealthcareDashboard.cs (97%)
create mode 100644 e2e/Sandbox/DashboardCreators/IDashboardCreator.cs
rename e2e/Sandbox/{Factories => DashboardCreators}/ManufacturingDashboard.cs (98%)
rename e2e/Sandbox/{Factories => DashboardCreators}/MarketingDashboard.cs (98%)
rename e2e/Sandbox/{Factories/RestDataSourceDashboards.cs => DashboardCreators/RestDataSourceDashboard.cs} (92%)
rename e2e/Sandbox/{Factories => DashboardCreators}/SalesDashboard.cs (97%)
rename e2e/Sandbox/{Factories => DashboardCreators}/SqlServerDataSourceDashboards.cs (94%)
delete mode 100644 e2e/Sandbox/Helpers/DashboardFileNames.cs
create mode 100644 e2e/Sandbox/Properties/Settings.Designer.cs
create mode 100644 e2e/Sandbox/Properties/Settings.settings
diff --git a/e2e/Sandbox/App.config b/e2e/Sandbox/App.config
new file mode 100644
index 00000000..274bf3ac
--- /dev/null
+++ b/e2e/Sandbox/App.config
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/e2e/Sandbox/Factories/CampaignsDashboard.cs b/e2e/Sandbox/DashboardCreators/CampaignsDashboard.cs
similarity index 97%
rename from e2e/Sandbox/Factories/CampaignsDashboard.cs
rename to e2e/Sandbox/DashboardCreators/CampaignsDashboard.cs
index 781ecb8a..d137af1f 100644
--- a/e2e/Sandbox/Factories/CampaignsDashboard.cs
+++ b/e2e/Sandbox/DashboardCreators/CampaignsDashboard.cs
@@ -6,11 +6,13 @@
using Sandbox.Helpers;
using DataSourceFactory = Sandbox.Helpers.DataSourceFactory;
-namespace Sandbox.Factories
+namespace Sandbox.DashboardFactories
{
- internal class CampaignsDashboard
+ internal class CampaignsDashboard: IDashboardCreator
{
- internal static RdashDocument CreateDashboard()
+ public string Name => "Campaigns";
+
+ public RdashDocument CreateDashboard()
{
var excelDataSourceItem = DataSourceFactory.GetMarketingDataSourceItem();
diff --git a/e2e/Sandbox/Factories/CustomDashboard.cs b/e2e/Sandbox/DashboardCreators/CustomDashboard.cs
similarity index 97%
rename from e2e/Sandbox/Factories/CustomDashboard.cs
rename to e2e/Sandbox/DashboardCreators/CustomDashboard.cs
index d1429d66..57efe89a 100644
--- a/e2e/Sandbox/Factories/CustomDashboard.cs
+++ b/e2e/Sandbox/DashboardCreators/CustomDashboard.cs
@@ -1,314 +1,316 @@
-using Reveal.Sdk.Dom;
-using Reveal.Sdk.Dom.Data;
-using Reveal.Sdk.Dom.Visualizations;
-using Sandbox.Helpers;
-
-namespace Sandbox.Factories
-{
- internal class CustomDashboard
- {
- internal static RdashDocument CreateDashboard()
- {
- var factory = new DataSourceItemFactory();
-
- var excelDataSourceItem = new RestDataSourceItem("Marketing Sheet")
- {
- Subtitle = "Excel Data Source Item",
- Uri = "http://dl.infragistics.com/reportplus/reveal/samples/Samples.xlsx",
- IsAnonymous = true,
- Fields = DataSourceFactory.GetMarketingDataSourceFields(),
- };
- excelDataSourceItem.UseExcel("Marketing");
-
- var csvDataSourceItem = new RestDataSourceItem("Illinois School Info")
- {
- Subtitle = "CSV Data Source Item",
- Uri = "https://query.data.world/s/y32gtgblzpemyyvtig47dz7tedgkto",
- IsAnonymous = true,
- Fields = DataSourceFactory.GetCsvDataSourceFields(),
- };
- csvDataSourceItem.UseCsv();
-
- var financialDataSourceItem = new RestDataSourceItem("OHLC")
- {
- Subtitle = "Financial Data Source Item",
- Uri = "https://excel2json.io/api/share/8bb2cd78-1b87-4142-00a2-08da188ec9ab",
- IsAnonymous = true,
- Fields = DataSourceFactory.GetOHLCDataSourceFields(),
- };
-
- var revenueDataSourceItem = new RestDataSourceItem("Revenue")
- {
- Subtitle = "Choropleth Data Source Item",
- Uri = "https://excel2json.io/api/share/818e7b9a-f463-4565-435d-08da496bf5f2",
- IsAnonymous = true,
- Fields = DataSourceFactory.GetRevenueDataSourceFields(),
- };
-
- var document = new RdashDocument()
- {
- Title = "Custom Dashboard",
- Description = "Playing with the Fluent API",
- Theme = Theme.TropicalIsland
- };
-
- //grid
- document.Visualizations.Add(new GridVisualization("Grid", excelDataSourceItem)
- .SetColumns("Territory", "Conversions", "Spend"));
-
- //text view
- document.Visualizations.Add(new TextViewVisualization("TextView", excelDataSourceItem)
- .SetColumns("Territory", "Conversions", "Spend"));
-
- //pivot
- document.Visualizations.Add(new PivotVisualization("Pivot", excelDataSourceItem)
- .SetRow("Territory").SetValue("New Seats").SetColumn("CampaignID")
- .ConfigureSettings(settings =>
- {
- settings.ShowGrandTotals = true;
- }));
-
- //column
- document.Visualizations.Add(new ColumnChartVisualization("Column", excelDataSourceItem)
- .SetLabel("Date").SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
-
- //bar
- document.Visualizations.Add(new BarChartVisualization("Bar", excelDataSourceItem)
- .SetLabel("Date").SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
-
- //pie
- document.Visualizations.Add(new PieChartVisualization("Pie", excelDataSourceItem)
- .SetLabel("Territory").SetValue("Conversions")
- .ConfigureSettings(settings =>
- {
- settings.SliceLabelDisplay = LabelDisplayMode.Value;
- }));
-
- //doughnut
- document.Visualizations.Add(new DoughnutChartVisualization("Doughnut", excelDataSourceItem)
- .SetLabel("Territory").SetValue("Conversions")
- .ConfigureSettings(settings =>
- {
- settings.SliceLabelDisplay = LabelDisplayMode.ValueAndPercentage;
- settings.StartPosition = 90;
- }));
-
- //funnel
- document.Visualizations.Add(new FunnelChartVisualization("Funnel", excelDataSourceItem)
- .SetLabel("Territory")
- .SetValue("Conversions")
- .ConfigureSettings(settings =>
- {
- settings.SliceLabelDisplay = LabelDisplayMode.Percentage;
- }));
-
- //combo
- document.Visualizations.Add(new ComboChartVisualization("Combo", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetChart1Value("Spend")
- .SetChart2Value("Budget")
- .ConfigureSettings(settings =>
- {
- settings.Chart1Type = ComboChartType.Column;
- settings.Chart2Type = ComboChartType.Line;
- settings.ShowRightAxis = false;
- settings.StartColorIndex = 5;
- }));
-
- //stacked column
- document.Visualizations.Add(new StackedColumnChartVisualization("Stacked Column", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
-
- //stacked bar
- document.Visualizations.Add(new StackedBarChartVisualization("Stacked Bar", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
-
- //stacked area
- document.Visualizations.Add(new StackedAreaChartVisualization("Stacked Area", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
-
- //area
- document.Visualizations.Add(new AreaChartVisualization("Area", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
-
- //line
- document.Visualizations.Add(new LineChartVisualization("Line", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValue("Conversions"));
-
- //step area
- document.Visualizations.Add(new StepAreaChartVisualization("Step Area", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Spend", "Budget"));
-
- //step line
- document.Visualizations.Add(new StepLineChartVisualization("Step Line", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Spend", "Budget"));
-
- //spline area
- document.Visualizations.Add(new SplineAreaChartVisualization("Spline Area", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Spend", "Budget"));
-
- //spline
- document.Visualizations.Add(new SplineChartVisualization("Spline", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Spend", "Budget"));
-
- //linear gauge
- document.Visualizations.Add(new LinearGaugeVisualization("Linear", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month }).SetValue("Spend")
- .ConfigureSettings(settings =>
- {
- settings.ValueComparisonType = ValueComparisonType.Number;
- settings.UpperBand.Value = 10000;
- settings.MiddleBand.Value = 5000;
- }));
-
- //circular gauge
- document.Visualizations.Add(new CircularGaugeVisualization("Circular", excelDataSourceItem).SetLabel("Budget").SetValue("Spend")
- .ConfigureSettings(settings =>
- {
- settings.MiddleBand.Value = 30;
- }));
-
- //text
- document.Visualizations.Add(new TextVisualization("Text", excelDataSourceItem).SetLabel("Budget").SetValue("Spend")
- .ConfigureSettings(settings =>
- {
- settings.ConditionalFormattingEnabled = true;
- settings.UpperBand.Shape = ShapeType.ArrowUp;
- settings.MiddleBand.Shape = ShapeType.Dash;
- settings.LowerBand.Shape = ShapeType.ArrowDown;
- }));
-
- //kpi target
- document.Visualizations.Add(new KpiTargetVisualization("KPI vs Target", excelDataSourceItem).SetDate("Date").SetValue("Spend").SetTarget("Budget")
- .ConfigureSettings(settings =>
- {
- settings.DifferenceMode = IndicatorDifferenceMode.ValueAndPercentage;
- settings.GoalPeriod = KpiGoalPeriod.ThisYear;
- }));
-
- //kpi time
- document.Visualizations.Add(new KpiTimeVisualization("KPI vs Time", excelDataSourceItem).SetDate("Date").SetValue("Traffic")
- .ConfigureSettings(settings =>
- {
- settings.DifferenceMode = IndicatorDifferenceMode.ValueAndPercentage;
- settings.TimePeriod = KpiTimePeriod.MonthToDatePreviousMonth;
- }));
-
- //bullet graph
- document.Visualizations.Add(new BulletGraphVisualization("Bullet Graph", excelDataSourceItem).SetLabel("CampaignID").SetValue("Spend").SetTarget("Budget")
- .ConfigureSettings(setting =>
- {
- setting.ValueComparisonType = ValueComparisonType.Number;
- setting.UpperBand.Value = 72000;
- setting.MiddleBand.Value = 65000;
- }));
-
- //choropleth map
- document.Visualizations.Add(new ChoroplethVisualization("Choropleth", revenueDataSourceItem)
- .SetMap(Maps.NorthAmerica.UnitedStates.States.AllStates)
- .SetLocation("State")
- .SetValue("Revenue")
- .ConfigureSettings(settings =>
- {
- settings.ColorIndex = 5;
- settings.ColorStyle = MapColorStyle.SingleColor;
- settings.LabelStyle = MapLabelStyle.Values;
- }));
-
- //scatter map
- document.Visualizations.Add(new ScatterMapVisualization("Scatter Map", csvDataSourceItem)
- .SetMap(Maps.NorthAmerica.UnitedStates.States.Illinois)
- .SetLongitude("X")
- .SetLatitude("Y")
- .SetLabel("School_Nm")
- .SetColorByValue(new NumberDataField("Grades") { AggregationType = AggregationType.Avg })
- .ConfigureSettings(settings =>
- {
- settings.ColorIndex = 5;
- settings.ColorMode = MapColorMode.ConditionalFormatting;
-
- settings.ConditionalFormatting.ValueComparisonType = ValueComparisonType.Percentage;
- settings.ConditionalFormatting.UpperBand.Value = 90;
- settings.ConditionalFormatting.MiddleBand.Value = 60;
-
- settings.Zoom.Longitude = 1.38;
- settings.Zoom.Latitude = 41.65;
- settings.Zoom.DegreesLongitude = 1.04;
- settings.Zoom.DegreesLatitude = 0.39;
- }));
-
- //tree map
- document.Visualizations.Add(new TreeMapVisualization("Tree Map", excelDataSourceItem)
- .SetLabel("Territory").SetValue("Traffic"));
-
- //bubble
- document.Visualizations.Add(new BubbleVisualization("Bubble", excelDataSourceItem)
- .SetLabel("CampaignID").SetXAxis("Budget").SetYAxis("Spend").SetRadius("Traffic"));
-
- //scatter
- document.Visualizations.Add(new ScatterVisualization("Scatter", excelDataSourceItem)
- .SetLabel("CampaignID").SetXAxis("Budget").SetYAxis("Spend"));
-
- //time series
- document.Visualizations.Add(new TimeSeriesVisualization("Time Series", excelDataSourceItem)
- .SetDate(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
-
- //radial
- document.Visualizations.Add(new RadialVisualization("Radial", excelDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
- .SetValues("Spend", "Budget"));
-
- //image
- document.Visualizations.Add(new ImageVisualization("Image", excelDataSourceItem).SetUrl("Territory"));
-
- //sparkline
- document.Visualizations.Add(new SparklineVisualization("Sparkline", excelDataSourceItem)
- .SetDate("Date")
- .SetValue("Spend")
- .SetCategory("Territory")
- .ConfigureSettings(settings =>
- {
- settings.ShowLastTwoValues = false;
- settings.NumberOfPeriods = 10;
- settings.AggregationType = SparklineAggregationType.Months;
- }));
-
- //textbox
- document.Visualizations.Add(new TextBoxVisualization("TextBox").SetText("This is some text").SetFontSize(FontSize.Large));
-
- //custom
- document.Visualizations.Add(new CustomVisualization("Custom", excelDataSourceItem)
- .SetUrl("https://dl.infragistics.com/reportplus/diy/HelloWorld-Desktop-EN.html")
- .SetRows("Territory", "CampaignID")
- .SetValues("Spend", "Budget"));
-
- //OHLC
- document.Visualizations.Add(new OHLCVisualization("OHLC", financialDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Day })
- .SetOpen("Open")
- .SetHigh("High")
- .SetLow("Low")
- .SetClose("Close"));
-
- //Candle stick
- document.Visualizations.Add(new CandleStickVisualization("Candlestick", financialDataSourceItem)
- .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Day })
- .SetOpen("Open")
- .SetHigh("High")
- .SetLow("Low")
- .SetClose("Close"));
-
- return document;
- }
- }
+using Reveal.Sdk.Dom;
+using Reveal.Sdk.Dom.Data;
+using Reveal.Sdk.Dom.Visualizations;
+using Sandbox.Helpers;
+
+namespace Sandbox.DashboardFactories
+{
+ internal class CustomDashboard : IDashboardCreator
+ {
+ public string Name => "Custom";
+
+ public RdashDocument CreateDashboard()
+ {
+ var factory = new DataSourceItemFactory();
+
+ var excelDataSourceItem = new RestDataSourceItem("Marketing Sheet")
+ {
+ Subtitle = "Excel Data Source Item",
+ Uri = "http://dl.infragistics.com/reportplus/reveal/samples/Samples.xlsx",
+ IsAnonymous = true,
+ Fields = DataSourceFactory.GetMarketingDataSourceFields(),
+ };
+ excelDataSourceItem.UseExcel("Marketing");
+
+ var csvDataSourceItem = new RestDataSourceItem("Illinois School Info")
+ {
+ Subtitle = "CSV Data Source Item",
+ Uri = "https://query.data.world/s/y32gtgblzpemyyvtig47dz7tedgkto",
+ IsAnonymous = true,
+ Fields = DataSourceFactory.GetCsvDataSourceFields(),
+ };
+ csvDataSourceItem.UseCsv();
+
+ var financialDataSourceItem = new RestDataSourceItem("OHLC")
+ {
+ Subtitle = "Financial Data Source Item",
+ Uri = "https://excel2json.io/api/share/8bb2cd78-1b87-4142-00a2-08da188ec9ab",
+ IsAnonymous = true,
+ Fields = DataSourceFactory.GetOHLCDataSourceFields(),
+ };
+
+ var revenueDataSourceItem = new RestDataSourceItem("Revenue")
+ {
+ Subtitle = "Choropleth Data Source Item",
+ Uri = "https://excel2json.io/api/share/818e7b9a-f463-4565-435d-08da496bf5f2",
+ IsAnonymous = true,
+ Fields = DataSourceFactory.GetRevenueDataSourceFields(),
+ };
+
+ var document = new RdashDocument()
+ {
+ Title = "Custom Dashboard",
+ Description = "Playing with the Fluent API",
+ Theme = Theme.TropicalIsland
+ };
+
+ //grid
+ document.Visualizations.Add(new GridVisualization("Grid", excelDataSourceItem)
+ .SetColumns("Territory", "Conversions", "Spend"));
+
+ //text view
+ document.Visualizations.Add(new TextViewVisualization("TextView", excelDataSourceItem)
+ .SetColumns("Territory", "Conversions", "Spend"));
+
+ //pivot
+ document.Visualizations.Add(new PivotVisualization("Pivot", excelDataSourceItem)
+ .SetRow("Territory").SetValue("New Seats").SetColumn("CampaignID")
+ .ConfigureSettings(settings =>
+ {
+ settings.ShowGrandTotals = true;
+ }));
+
+ //column
+ document.Visualizations.Add(new ColumnChartVisualization("Column", excelDataSourceItem)
+ .SetLabel("Date").SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
+
+ //bar
+ document.Visualizations.Add(new BarChartVisualization("Bar", excelDataSourceItem)
+ .SetLabel("Date").SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
+
+ //pie
+ document.Visualizations.Add(new PieChartVisualization("Pie", excelDataSourceItem)
+ .SetLabel("Territory").SetValue("Conversions")
+ .ConfigureSettings(settings =>
+ {
+ settings.SliceLabelDisplay = LabelDisplayMode.Value;
+ }));
+
+ //doughnut
+ document.Visualizations.Add(new DoughnutChartVisualization("Doughnut", excelDataSourceItem)
+ .SetLabel("Territory").SetValue("Conversions")
+ .ConfigureSettings(settings =>
+ {
+ settings.SliceLabelDisplay = LabelDisplayMode.ValueAndPercentage;
+ settings.StartPosition = 90;
+ }));
+
+ //funnel
+ document.Visualizations.Add(new FunnelChartVisualization("Funnel", excelDataSourceItem)
+ .SetLabel("Territory")
+ .SetValue("Conversions")
+ .ConfigureSettings(settings =>
+ {
+ settings.SliceLabelDisplay = LabelDisplayMode.Percentage;
+ }));
+
+ //combo
+ document.Visualizations.Add(new ComboChartVisualization("Combo", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetChart1Value("Spend")
+ .SetChart2Value("Budget")
+ .ConfigureSettings(settings =>
+ {
+ settings.Chart1Type = ComboChartType.Column;
+ settings.Chart2Type = ComboChartType.Line;
+ settings.ShowRightAxis = false;
+ settings.StartColorIndex = 5;
+ }));
+
+ //stacked column
+ document.Visualizations.Add(new StackedColumnChartVisualization("Stacked Column", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
+
+ //stacked bar
+ document.Visualizations.Add(new StackedBarChartVisualization("Stacked Bar", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
+
+ //stacked area
+ document.Visualizations.Add(new StackedAreaChartVisualization("Stacked Area", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
+
+ //area
+ document.Visualizations.Add(new AreaChartVisualization("Area", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
+
+ //line
+ document.Visualizations.Add(new LineChartVisualization("Line", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValue("Conversions"));
+
+ //step area
+ document.Visualizations.Add(new StepAreaChartVisualization("Step Area", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Spend", "Budget"));
+
+ //step line
+ document.Visualizations.Add(new StepLineChartVisualization("Step Line", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Spend", "Budget"));
+
+ //spline area
+ document.Visualizations.Add(new SplineAreaChartVisualization("Spline Area", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Spend", "Budget"));
+
+ //spline
+ document.Visualizations.Add(new SplineChartVisualization("Spline", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Spend", "Budget"));
+
+ //linear gauge
+ document.Visualizations.Add(new LinearGaugeVisualization("Linear", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month }).SetValue("Spend")
+ .ConfigureSettings(settings =>
+ {
+ settings.ValueComparisonType = ValueComparisonType.Number;
+ settings.UpperBand.Value = 10000;
+ settings.MiddleBand.Value = 5000;
+ }));
+
+ //circular gauge
+ document.Visualizations.Add(new CircularGaugeVisualization("Circular", excelDataSourceItem).SetLabel("Budget").SetValue("Spend")
+ .ConfigureSettings(settings =>
+ {
+ settings.MiddleBand.Value = 30;
+ }));
+
+ //text
+ document.Visualizations.Add(new TextVisualization("Text", excelDataSourceItem).SetLabel("Budget").SetValue("Spend")
+ .ConfigureSettings(settings =>
+ {
+ settings.ConditionalFormattingEnabled = true;
+ settings.UpperBand.Shape = ShapeType.ArrowUp;
+ settings.MiddleBand.Shape = ShapeType.Dash;
+ settings.LowerBand.Shape = ShapeType.ArrowDown;
+ }));
+
+ //kpi target
+ document.Visualizations.Add(new KpiTargetVisualization("KPI vs Target", excelDataSourceItem).SetDate("Date").SetValue("Spend").SetTarget("Budget")
+ .ConfigureSettings(settings =>
+ {
+ settings.DifferenceMode = IndicatorDifferenceMode.ValueAndPercentage;
+ settings.GoalPeriod = KpiGoalPeriod.ThisYear;
+ }));
+
+ //kpi time
+ document.Visualizations.Add(new KpiTimeVisualization("KPI vs Time", excelDataSourceItem).SetDate("Date").SetValue("Traffic")
+ .ConfigureSettings(settings =>
+ {
+ settings.DifferenceMode = IndicatorDifferenceMode.ValueAndPercentage;
+ settings.TimePeriod = KpiTimePeriod.MonthToDatePreviousMonth;
+ }));
+
+ //bullet graph
+ document.Visualizations.Add(new BulletGraphVisualization("Bullet Graph", excelDataSourceItem).SetLabel("CampaignID").SetValue("Spend").SetTarget("Budget")
+ .ConfigureSettings(setting =>
+ {
+ setting.ValueComparisonType = ValueComparisonType.Number;
+ setting.UpperBand.Value = 72000;
+ setting.MiddleBand.Value = 65000;
+ }));
+
+ //choropleth map
+ document.Visualizations.Add(new ChoroplethVisualization("Choropleth", revenueDataSourceItem)
+ .SetMap(Maps.NorthAmerica.UnitedStates.States.AllStates)
+ .SetLocation("State")
+ .SetValue("Revenue")
+ .ConfigureSettings(settings =>
+ {
+ settings.ColorIndex = 5;
+ settings.ColorStyle = MapColorStyle.SingleColor;
+ settings.LabelStyle = MapLabelStyle.Values;
+ }));
+
+ //scatter map
+ document.Visualizations.Add(new ScatterMapVisualization("Scatter Map", csvDataSourceItem)
+ .SetMap(Maps.NorthAmerica.UnitedStates.States.Illinois)
+ .SetLongitude("X")
+ .SetLatitude("Y")
+ .SetLabel("School_Nm")
+ .SetColorByValue(new NumberDataField("Grades") { AggregationType = AggregationType.Avg })
+ .ConfigureSettings(settings =>
+ {
+ settings.ColorIndex = 5;
+ settings.ColorMode = MapColorMode.ConditionalFormatting;
+
+ settings.ConditionalFormatting.ValueComparisonType = ValueComparisonType.Percentage;
+ settings.ConditionalFormatting.UpperBand.Value = 90;
+ settings.ConditionalFormatting.MiddleBand.Value = 60;
+
+ settings.Zoom.Longitude = 1.38;
+ settings.Zoom.Latitude = 41.65;
+ settings.Zoom.DegreesLongitude = 1.04;
+ settings.Zoom.DegreesLatitude = 0.39;
+ }));
+
+ //tree map
+ document.Visualizations.Add(new TreeMapVisualization("Tree Map", excelDataSourceItem)
+ .SetLabel("Territory").SetValue("Traffic"));
+
+ //bubble
+ document.Visualizations.Add(new BubbleVisualization("Bubble", excelDataSourceItem)
+ .SetLabel("CampaignID").SetXAxis("Budget").SetYAxis("Spend").SetRadius("Traffic"));
+
+ //scatter
+ document.Visualizations.Add(new ScatterVisualization("Scatter", excelDataSourceItem)
+ .SetLabel("CampaignID").SetXAxis("Budget").SetYAxis("Spend"));
+
+ //time series
+ document.Visualizations.Add(new TimeSeriesVisualization("Time Series", excelDataSourceItem)
+ .SetDate(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Paid Traffic", "Organic Traffic", "Other Traffic"));
+
+ //radial
+ document.Visualizations.Add(new RadialVisualization("Radial", excelDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Month })
+ .SetValues("Spend", "Budget"));
+
+ //image
+ document.Visualizations.Add(new ImageVisualization("Image", excelDataSourceItem).SetUrl("Territory"));
+
+ //sparkline
+ document.Visualizations.Add(new SparklineVisualization("Sparkline", excelDataSourceItem)
+ .SetDate("Date")
+ .SetValue("Spend")
+ .SetCategory("Territory")
+ .ConfigureSettings(settings =>
+ {
+ settings.ShowLastTwoValues = false;
+ settings.NumberOfPeriods = 10;
+ settings.AggregationType = SparklineAggregationType.Months;
+ }));
+
+ //textbox
+ document.Visualizations.Add(new TextBoxVisualization("TextBox").SetText("This is some text").SetFontSize(FontSize.Large));
+
+ //custom
+ document.Visualizations.Add(new CustomVisualization("Custom", excelDataSourceItem)
+ .SetUrl("https://dl.infragistics.com/reportplus/diy/HelloWorld-Desktop-EN.html")
+ .SetRows("Territory", "CampaignID")
+ .SetValues("Spend", "Budget"));
+
+ //OHLC
+ document.Visualizations.Add(new OHLCVisualization("OHLC", financialDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Day })
+ .SetOpen("Open")
+ .SetHigh("High")
+ .SetLow("Low")
+ .SetClose("Close"));
+
+ //Candle stick
+ document.Visualizations.Add(new CandleStickVisualization("Candlestick", financialDataSourceItem)
+ .SetLabel(new DateDataField("Date") { AggregationType = DateAggregationType.Day })
+ .SetOpen("Open")
+ .SetHigh("High")
+ .SetLow("Low")
+ .SetClose("Close"));
+
+ return document;
+ }
+ }
}
\ No newline at end of file
diff --git a/e2e/Sandbox/Factories/DashboardLinkingDashboard.cs b/e2e/Sandbox/DashboardCreators/DashboardLinkingDashboard.cs
similarity index 92%
rename from e2e/Sandbox/Factories/DashboardLinkingDashboard.cs
rename to e2e/Sandbox/DashboardCreators/DashboardLinkingDashboard.cs
index e44b80aa..de68038b 100644
--- a/e2e/Sandbox/Factories/DashboardLinkingDashboard.cs
+++ b/e2e/Sandbox/DashboardCreators/DashboardLinkingDashboard.cs
@@ -7,11 +7,13 @@
using System.IO;
using System.Linq;
-namespace Sandbox.Factories
+namespace Sandbox.DashboardFactories
{
- internal class DashboardLinkingDashboard
+ internal class DashboardLinkingDashboard : IDashboardCreator
{
- internal static RdashDocument CreateDashboard()
+ public string Name => "Dashboard Linking";
+
+ public RdashDocument CreateDashboard()
{
var excelDataSourceItem = DataSourceFactory.GetMarketingDataSourceItem();
diff --git a/e2e/Sandbox/Factories/HealthcareDashboard.cs b/e2e/Sandbox/DashboardCreators/HealthcareDashboard.cs
similarity index 97%
rename from e2e/Sandbox/Factories/HealthcareDashboard.cs
rename to e2e/Sandbox/DashboardCreators/HealthcareDashboard.cs
index 3ecd2f8a..591d6953 100644
--- a/e2e/Sandbox/Factories/HealthcareDashboard.cs
+++ b/e2e/Sandbox/DashboardCreators/HealthcareDashboard.cs
@@ -5,11 +5,13 @@
using Sandbox.Helpers;
using DataSourceFactory = Sandbox.Helpers.DataSourceFactory;
-namespace Sandbox.Factories
+namespace Sandbox.DashboardFactories
{
- internal class HealthcareDashboard
+ internal class HealthcareDashboard : IDashboardCreator
{
- internal static RdashDocument CreateDashboard()
+ public string Name => "Healthcare";
+
+ public RdashDocument CreateDashboard()
{
var excelDataSourceItem = DataSourceFactory.GetHealthcareDataSourceItem();
diff --git a/e2e/Sandbox/DashboardCreators/IDashboardCreator.cs b/e2e/Sandbox/DashboardCreators/IDashboardCreator.cs
new file mode 100644
index 00000000..905a9882
--- /dev/null
+++ b/e2e/Sandbox/DashboardCreators/IDashboardCreator.cs
@@ -0,0 +1,10 @@
+using Reveal.Sdk.Dom;
+
+namespace Sandbox.DashboardFactories
+{
+ interface IDashboardCreator
+ {
+ string Name { get; }
+ RdashDocument CreateDashboard();
+ }
+}
diff --git a/e2e/Sandbox/Factories/ManufacturingDashboard.cs b/e2e/Sandbox/DashboardCreators/ManufacturingDashboard.cs
similarity index 98%
rename from e2e/Sandbox/Factories/ManufacturingDashboard.cs
rename to e2e/Sandbox/DashboardCreators/ManufacturingDashboard.cs
index 5ffbc432..ccc9b706 100644
--- a/e2e/Sandbox/Factories/ManufacturingDashboard.cs
+++ b/e2e/Sandbox/DashboardCreators/ManufacturingDashboard.cs
@@ -6,11 +6,13 @@
using System.Linq;
using DataSourceFactory = Sandbox.Helpers.DataSourceFactory;
-namespace Sandbox.Factories
+namespace Sandbox.DashboardFactories
{
- internal class ManufacturingDashboard
+ internal class ManufacturingDashboard : IDashboardCreator
{
- internal static RdashDocument CreateDashboard()
+ public string Name => "Manufacturing";
+
+ public RdashDocument CreateDashboard()
{
var excelDataSourceItem = DataSourceFactory.GetManufacturingDataSourceItem();
diff --git a/e2e/Sandbox/Factories/MarketingDashboard.cs b/e2e/Sandbox/DashboardCreators/MarketingDashboard.cs
similarity index 98%
rename from e2e/Sandbox/Factories/MarketingDashboard.cs
rename to e2e/Sandbox/DashboardCreators/MarketingDashboard.cs
index f16839e7..95f220fb 100644
--- a/e2e/Sandbox/Factories/MarketingDashboard.cs
+++ b/e2e/Sandbox/DashboardCreators/MarketingDashboard.cs
@@ -6,13 +6,15 @@
using Sandbox.Helpers;
using DataSourceFactory = Sandbox.Helpers.DataSourceFactory;
-namespace Sandbox.Factories
+namespace Sandbox.DashboardFactories
{
- internal class MarketingDashboard
+ internal class MarketingDashboard : IDashboardCreator
{
+ public string Name => "Marketing";
+
static Binding _globalDateFilterBinding = new DashboardDateFilterBinding("Date");
- internal static RdashDocument CreateDashboard()
+ public RdashDocument CreateDashboard()
{
var document = new RdashDocument()
{
diff --git a/e2e/Sandbox/Factories/RestDataSourceDashboards.cs b/e2e/Sandbox/DashboardCreators/RestDataSourceDashboard.cs
similarity index 92%
rename from e2e/Sandbox/Factories/RestDataSourceDashboards.cs
rename to e2e/Sandbox/DashboardCreators/RestDataSourceDashboard.cs
index b71f1f97..1db230b4 100644
--- a/e2e/Sandbox/Factories/RestDataSourceDashboards.cs
+++ b/e2e/Sandbox/DashboardCreators/RestDataSourceDashboard.cs
@@ -1,63 +1,65 @@
-using Reveal.Sdk.Dom;
-using Reveal.Sdk.Dom.Data;
-using Reveal.Sdk.Dom.Visualizations;
-using Sandbox.Helpers;
-
-namespace Sandbox.Factories
-{
- internal class RestDataSourceDashboards
- {
- internal static RdashDocument CreateDashboard()
- {
- var document = new RdashDocument("My Dashboard");
-
- //json - default
- var jsonDataSourceItem = new RestDataSourceItem("Sales by Category", new DataSource { Title = "JSON DS", Subtitle = "JSON DS Subtitle" })
- {
- Subtitle = "JSON Data Source Item",
- Uri = "https://excel2json.io/api/share/6e0f06b3-72d3-4fec-7984-08da43f56bb9",
- IsAnonymous = true,
- Fields = DataSourceFactory.GetSalesByCategoryFields(),
- };
-
- document.Visualizations.Add(new PieChartVisualization("JSON", jsonDataSourceItem)
- .SetLabel("CategoryName").SetValue("ProductSales"));
-
- //excel
- RestDataSourceItem excelDataSourceItem = new RestDataSourceItem("Marketing", "http://dl.infragistics.com/reportplus/reveal/samples/Samples.xlsx",
- new DataSource { Title = "Excel DS", Subtitle = "Excel DS Subtitle" })
- {
- Subtitle = "Excel Data Source Item",
- IsAnonymous = true,
- Fields = DataSourceFactory.GetMarketingDataSourceFields(),
- };
- excelDataSourceItem.UseExcel("Marketing");
-
- document.Visualizations.Add(new PieChartVisualization("Excel", excelDataSourceItem)
- .SetLabel("Territory").SetValue("Conversions"));
-
- //csv
- var csvDataSourceItem = new RestDataSourceItem("Illinois School Info", new DataSource() { Title = "CSV DS", Subtitle = "CSV DS Subtitle" })
- .SetSubtitle("CSV Data Source Item")
- .SetUri("https://query.data.world/s/y32gtgblzpemyyvtig47dz7tedgkto")
- .SetIsAnonymous(true)
- .SetFields(DataSourceFactory.GetCsvDataSourceFields())
- .WithCsv();
-
- document.Visualizations.Add(new ScatterMapVisualization("Scatter", csvDataSourceItem)
- .SetMap(Maps.NorthAmerica.UnitedStates.States.Illinois)
- .SetLongitude("X")
- .SetLatitude("Y")
- .SetLabel("School_Nm")
- .ConfigureSettings(settings =>
- {
- settings.Zoom.Longitude = 1.38;
- settings.Zoom.Latitude = 41.65;
- settings.Zoom.DegreesLongitude = 1.04;
- settings.Zoom.DegreesLatitude = 0.39;
- }));
-
- return document;
- }
- }
-}
+using Reveal.Sdk.Dom;
+using Reveal.Sdk.Dom.Data;
+using Reveal.Sdk.Dom.Visualizations;
+using Sandbox.Helpers;
+
+namespace Sandbox.DashboardFactories
+{
+ internal class RestDataSourceDashboard: IDashboardCreator
+ {
+ public string Name => "REST Data Source";
+
+ public RdashDocument CreateDashboard()
+ {
+ var document = new RdashDocument("My Dashboard");
+
+ //json - default
+ var jsonDataSourceItem = new RestDataSourceItem("Sales by Category", new DataSource { Title = "JSON DS", Subtitle = "JSON DS Subtitle" })
+ {
+ Subtitle = "JSON Data Source Item",
+ Uri = "https://excel2json.io/api/share/6e0f06b3-72d3-4fec-7984-08da43f56bb9",
+ IsAnonymous = true,
+ Fields = DataSourceFactory.GetSalesByCategoryFields(),
+ };
+
+ document.Visualizations.Add(new PieChartVisualization("JSON", jsonDataSourceItem)
+ .SetLabel("CategoryName").SetValue("ProductSales"));
+
+ //excel
+ RestDataSourceItem excelDataSourceItem = new RestDataSourceItem("Marketing", "http://dl.infragistics.com/reportplus/reveal/samples/Samples.xlsx",
+ new DataSource { Title = "Excel DS", Subtitle = "Excel DS Subtitle" })
+ {
+ Subtitle = "Excel Data Source Item",
+ IsAnonymous = true,
+ Fields = DataSourceFactory.GetMarketingDataSourceFields(),
+ };
+ excelDataSourceItem.UseExcel("Marketing");
+
+ document.Visualizations.Add(new PieChartVisualization("Excel", excelDataSourceItem)
+ .SetLabel("Territory").SetValue("Conversions"));
+
+ //csv
+ var csvDataSourceItem = new RestDataSourceItem("Illinois School Info", new DataSource() { Title = "CSV DS", Subtitle = "CSV DS Subtitle" })
+ .SetSubtitle("CSV Data Source Item")
+ .SetUri("https://query.data.world/s/y32gtgblzpemyyvtig47dz7tedgkto")
+ .SetIsAnonymous(true)
+ .SetFields(DataSourceFactory.GetCsvDataSourceFields())
+ .WithCsv();
+
+ document.Visualizations.Add(new ScatterMapVisualization("Scatter", csvDataSourceItem)
+ .SetMap(Maps.NorthAmerica.UnitedStates.States.Illinois)
+ .SetLongitude("X")
+ .SetLatitude("Y")
+ .SetLabel("School_Nm")
+ .ConfigureSettings(settings =>
+ {
+ settings.Zoom.Longitude = 1.38;
+ settings.Zoom.Latitude = 41.65;
+ settings.Zoom.DegreesLongitude = 1.04;
+ settings.Zoom.DegreesLatitude = 0.39;
+ }));
+
+ return document;
+ }
+ }
+}
diff --git a/e2e/Sandbox/Factories/SalesDashboard.cs b/e2e/Sandbox/DashboardCreators/SalesDashboard.cs
similarity index 97%
rename from e2e/Sandbox/Factories/SalesDashboard.cs
rename to e2e/Sandbox/DashboardCreators/SalesDashboard.cs
index c28d13ee..cb405ead 100644
--- a/e2e/Sandbox/Factories/SalesDashboard.cs
+++ b/e2e/Sandbox/DashboardCreators/SalesDashboard.cs
@@ -6,11 +6,13 @@
using System.Linq;
using DataSourceFactory = Sandbox.Helpers.DataSourceFactory;
-namespace Sandbox.Factories
+namespace Sandbox.DashboardFactories
{
- internal class SalesDashboard
+ internal class SalesDashboard : IDashboardCreator
{
- internal static RdashDocument CreateDashboard()
+ public string Name => "Sales";
+
+ public RdashDocument CreateDashboard()
{
var excelDataSourceItem = DataSourceFactory.GetSalesDataSourceItem();
diff --git a/e2e/Sandbox/Factories/SqlServerDataSourceDashboards.cs b/e2e/Sandbox/DashboardCreators/SqlServerDataSourceDashboards.cs
similarity index 94%
rename from e2e/Sandbox/Factories/SqlServerDataSourceDashboards.cs
rename to e2e/Sandbox/DashboardCreators/SqlServerDataSourceDashboards.cs
index 24baf35a..24672c11 100644
--- a/e2e/Sandbox/Factories/SqlServerDataSourceDashboards.cs
+++ b/e2e/Sandbox/DashboardCreators/SqlServerDataSourceDashboards.cs
@@ -1,68 +1,71 @@
-using Reveal.Sdk.Dom;
-using Reveal.Sdk.Dom.Data;
-using Reveal.Sdk.Dom.Visualizations;
-using System.Collections.Generic;
-
-namespace Sandbox.Factories
-{
- internal class SqlServerDataSourceDashboards
- {
- internal static RdashDocument CreateDashboard()
- {
- var sqlServerDS = new MicrosoftSqlServerDataSource()
- {
- Title = "Northwind",
- Subtitle = "Northwind Subtitle",
- Host = @"Brian-Desktop\SQLEXPRESS",
- Database = "Northwind",
- };
-
- var customers = new MicrosoftSqlServerDataSourceItem("Customers Table", "Customers", sqlServerDS)
- {
- Subtitle = "SQL Server Data Source Item",
- Fields = new List
- {
- new TextField("CustomerID"),
- new TextField("ContactName") { FieldLabel = "Customer Name" },
- new TextField("ContactTitle") { FieldLabel = "Customer Title" },
- new TextField("City") { FieldLabel = "Customer City" }
- }
- };
-
- var employees = new MicrosoftSqlServerDataSourceItem("Employees Table", sqlServerDS)
- {
- Subtitle = "SQL Server Data Source Item",
- Table = "Employees",
- Fields = new List
- {
- new NumberField("EmployeeID"),
- new TextField("FirstName") { FieldLabel = "Employee First Name" },
- new TextField("LastName") { FieldLabel = "Employee Last Name" },
- }
- };
-
- var orders = new MicrosoftSqlServerDataSourceItem("Orders Table", "Orders", sqlServerDS)
- {
- Fields = new List
- {
- new TextField("CustomerID"),
- new NumberField("EmployeeID") { FieldLabel = "Order Employee ID" },
- new DateField("OrderDate") { FieldLabel = "Oder Date" },
- new TextField("ShipName") { FieldLabel = "Order Ship Name" },
- },
- };
-
- customers.Join("A", "CustomerID", "CustomerID", orders);
- customers.Join("B", "A.EmployeeID", "EmployeeID", employees);
-
- var document = new RdashDocument("My Dashboard");
-
- document.Visualizations.Add(new GridVisualization("Customer List", customers).SetColumns("ContactName", "ContactTitle", "City"));
- document.Visualizations.Add(new GridVisualization("Employee List", employees).SetColumns("FirstName", "LastName"));
- document.Visualizations.Add(new GridVisualization("Joined Tables", customers).SetColumns("ContactName", "ContactTitle", "City",
- "A.EmployeeID", "A.OrderDate", "A.ShipName", "B.FirstName", "B.LastName"));
-
- return document;
- }
- }
-}
+using Reveal.Sdk.Dom;
+using Reveal.Sdk.Dom.Data;
+using Reveal.Sdk.Dom.Visualizations;
+using System.Collections.Generic;
+
+namespace Sandbox.DashboardFactories
+{
+ internal class SqlServerDataSourceDashboards
+ : IDashboardCreator
+ {
+ public string Name => "Sql Server Data Source";
+
+ public RdashDocument CreateDashboard()
+ {
+ var sqlServerDS = new MicrosoftSqlServerDataSource()
+ {
+ Title = "Northwind",
+ Subtitle = "Northwind Subtitle",
+ Host = @"Brian-Desktop\SQLEXPRESS",
+ Database = "Northwind",
+ };
+
+ var customers = new MicrosoftSqlServerDataSourceItem("Customers Table", "Customers", sqlServerDS)
+ {
+ Subtitle = "SQL Server Data Source Item",
+ Fields = new List
+ {
+ new TextField("CustomerID"),
+ new TextField("ContactName") { FieldLabel = "Customer Name" },
+ new TextField("ContactTitle") { FieldLabel = "Customer Title" },
+ new TextField("City") { FieldLabel = "Customer City" }
+ }
+ };
+
+ var employees = new MicrosoftSqlServerDataSourceItem("Employees Table", sqlServerDS)
+ {
+ Subtitle = "SQL Server Data Source Item",
+ Table = "Employees",
+ Fields = new List
+ {
+ new NumberField("EmployeeID"),
+ new TextField("FirstName") { FieldLabel = "Employee First Name" },
+ new TextField("LastName") { FieldLabel = "Employee Last Name" },
+ }
+ };
+
+ var orders = new MicrosoftSqlServerDataSourceItem("Orders Table", "Orders", sqlServerDS)
+ {
+ Fields = new List
+ {
+ new TextField("CustomerID"),
+ new NumberField("EmployeeID") { FieldLabel = "Order Employee ID" },
+ new DateField("OrderDate") { FieldLabel = "Oder Date" },
+ new TextField("ShipName") { FieldLabel = "Order Ship Name" },
+ },
+ };
+
+ customers.Join("A", "CustomerID", "CustomerID", orders);
+ customers.Join("B", "A.EmployeeID", "EmployeeID", employees);
+
+ var document = new RdashDocument("My Dashboard");
+
+ document.Visualizations.Add(new GridVisualization("Customer List", customers).SetColumns("ContactName", "ContactTitle", "City"));
+ document.Visualizations.Add(new GridVisualization("Employee List", employees).SetColumns("FirstName", "LastName"));
+ document.Visualizations.Add(new GridVisualization("Joined Tables", customers).SetColumns("ContactName", "ContactTitle", "City",
+ "A.EmployeeID", "A.OrderDate", "A.ShipName", "B.FirstName", "B.LastName"));
+
+ return document;
+ }
+ }
+}
diff --git a/e2e/Sandbox/Helpers/DashboardFileNames.cs b/e2e/Sandbox/Helpers/DashboardFileNames.cs
deleted file mode 100644
index 18f9a1e9..00000000
--- a/e2e/Sandbox/Helpers/DashboardFileNames.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Sandbox.Helpers
-{
- internal class DashboardFileNames
- {
- internal const string MyDashboard = "MyDashboard.rdash";
- internal const string Campaigns = "Campaigns.rdash";
- internal const string Healthcare = "Healthcare.rdash";
- internal const string Manufacturing = "Manufacturing.rdash";
- internal const string Marketing = "Marketing.rdash";
- internal const string Sales = "Sales.rdash";
- }
-}
diff --git a/e2e/Sandbox/MainWindow.xaml b/e2e/Sandbox/MainWindow.xaml
index 3ea01ade..a81abd25 100644
--- a/e2e/Sandbox/MainWindow.xaml
+++ b/e2e/Sandbox/MainWindow.xaml
@@ -19,7 +19,7 @@
-
+
diff --git a/e2e/Sandbox/MainWindow.xaml.cs b/e2e/Sandbox/MainWindow.xaml.cs
index b35e6cb1..1992d24c 100644
--- a/e2e/Sandbox/MainWindow.xaml.cs
+++ b/e2e/Sandbox/MainWindow.xaml.cs
@@ -22,20 +22,13 @@
using Reveal.Sdk.Data.Rest;
using Reveal.Sdk.Data.Snowflake;
using Reveal.Sdk.Dom;
-using Reveal.Sdk.Dom.Data;
-using Reveal.Sdk.Dom.Filters;
-using Reveal.Sdk.Dom.Visualizations;
-using Sandbox.Factories;
-using Sandbox.Helpers;
+using Sandbox.DashboardFactories;
using Sandbox.RevealSDK;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Threading.Tasks;
using System.Windows;
-using Windows.Management.Deployment;
-using Windows.Storage.Streams;
namespace Sandbox
{
@@ -45,12 +38,20 @@ namespace Sandbox
public partial class MainWindow : Window
{
static readonly string _dashboardFilePath = Path.Combine(Environment.CurrentDirectory, "Dashboards");
+ static readonly string _readFilePath = Path.Combine(_dashboardFilePath, "Healthcare.rdash");
- //readonly string _readFilePath = Path.Combine(_dashboardFilePath, DashboardFileNames.Sales);
- readonly string _readFilePath = Path.Combine(_dashboardFilePath, "Healthcare.rdash");
-
- readonly string _saveJsonToPath = Path.Combine(_dashboardFilePath, "MyDashboard.json");
- readonly string _saveRdashToPath = Path.Combine(_dashboardFilePath, DashboardFileNames.MyDashboard);
+ List _dashboardCreators = new List
+ {
+ new CampaignsDashboard(),
+ new CustomDashboard(),
+ new DashboardLinkingDashboard(),
+ new HealthcareDashboard(),
+ new ManufacturingDashboard(),
+ new MarketingDashboard(),
+ new RestDataSourceDashboard(),
+ new SalesDashboard(),
+ new SqlServerDataSourceDashboards(),
+ };
public MainWindow()
{
@@ -59,7 +60,8 @@ public MainWindow()
RevealSdkSettings.DataSourceProvider = new Sandbox.RevealSDK.DataSourceProvider();
RevealSdkSettings.AuthenticationProvider = new AuthenticationProvider();
RevealSdkSettings.DataSources.RegisterMicrosoftSqlServer().RegisterMicrosoftAnalysisServices();
- _dashboardTypeSelector.ItemsSource = Enum.GetValues(typeof(DataSourceType)).Cast();
+
+ LoadDashboards();
_revealView.LinkedDashboardProvider = (string dashboardId, string linkTitle) =>
{
@@ -71,8 +73,6 @@ public MainWindow()
};
_revealView.DataSourcesRequested += RevealView_DataSourcesRequested;
-
- _revealView.DashboardSelectorRequested += RevealView_DashboardSelectorRequested;
}
private void RevealView_DataSourcesRequested(object sender, DataSourcesRequestedEventArgs e)
@@ -180,11 +180,6 @@ private void RevealView_DataSourcesRequested(object sender, DataSourcesRequested
e.Callback(new RevealDataSources(ds, dsi, true));
}
- private void RevealView_DashboardSelectorRequested(object sender, DashboardSelectorRequestedEventArgs e)
- {
- e.Callback("Campaigns");
- }
-
private async void RevealView_SaveDashboard(object sender, DashboardSaveEventArgs e)
{
//var json = _revealView.Dashboard.ExportToJson();
@@ -211,39 +206,36 @@ private void Clear_Dashboard(object sender, RoutedEventArgs e)
private async void Read_Dashboard(object sender, RoutedEventArgs e)
{
- var document = RdashDocument.Load(_readFilePath);
-
+ var document = RdashDocument.Load(_readFilePath);
var json = document.ToJsonString();
_revealView.Dashboard = await RVDashboard.LoadFromJsonAsync(json);
}
private async void CreateDashboardWithTypeBtn_Click(object sender, RoutedEventArgs e)
{
- var selectedDSTypeItem = _dashboardTypeSelector.SelectedItem;
- if (selectedDSTypeItem != null)
+ var creator = _dashboardTypeSelector.SelectedItem as IDashboardCreator;
+ if (creator != null)
+ {
+ RdashDocument document = creator.CreateDashboard();
+ var json = document.ToJsonString();
+ _revealView.Dashboard = await RVDashboard.LoadFromJsonAsync(json);
+
+ // Save the last selected item to application settings
+ Properties.Settings.Default.LastSelectedDashboard = creator.Name;
+ Properties.Settings.Default.Save();
+ }
+ }
+
+ private void LoadDashboards()
+ {
+ _dashboardTypeSelector.ItemsSource = _dashboardCreators;
+
+ // Load the last selected item from application settings
+ var lastSelectedName = Properties.Settings.Default.LastSelectedDashboard;
+ if (!string.IsNullOrEmpty(lastSelectedName))
{
- var dataSourceType = _dashboardTypeSelector.SelectedItem;
- RdashDocument document = null;
- switch (dataSourceType)
- {
- case DataSourceType.REST:
- document = SalesDashboard.CreateDashboard();
- break;
- case DataSourceType.MicrosoftSqlServer:
- break;
- default:
- break;
- }
-
- if (document != null)
- {
- var json = document.ToJsonString();
- _revealView.Dashboard = await RVDashboard.LoadFromJsonAsync(json);
- }
- else
- {
- _revealView.Dashboard = new RVDashboard();
- }
+ var selectedDashboard = _dashboardCreators.FirstOrDefault(x => x.Name == lastSelectedName);
+ _dashboardTypeSelector.SelectedItem = selectedDashboard;
}
}
}
diff --git a/e2e/Sandbox/Properties/Settings.Designer.cs b/e2e/Sandbox/Properties/Settings.Designer.cs
new file mode 100644
index 00000000..6ec3e987
--- /dev/null
+++ b/e2e/Sandbox/Properties/Settings.Designer.cs
@@ -0,0 +1,38 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Sandbox.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string LastSelectedDashboard {
+ get {
+ return ((string)(this["LastSelectedDashboard"]));
+ }
+ set {
+ this["LastSelectedDashboard"] = value;
+ }
+ }
+ }
+}
diff --git a/e2e/Sandbox/Properties/Settings.settings b/e2e/Sandbox/Properties/Settings.settings
new file mode 100644
index 00000000..0705108c
--- /dev/null
+++ b/e2e/Sandbox/Properties/Settings.settings
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/e2e/Sandbox/Sandbox.csproj b/e2e/Sandbox/Sandbox.csproj
index f9767905..ab00be8b 100644
--- a/e2e/Sandbox/Sandbox.csproj
+++ b/e2e/Sandbox/Sandbox.csproj
@@ -51,6 +51,10 @@
PreserveNewest
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
@@ -64,4 +68,12 @@
+
+
+ True
+ True
+ Settings.settings
+
+
+