Skip to content

Commit

Permalink
Merge branch 'unit-test/rest' of https://github.com/RevealBi/Reveal.S…
Browse files Browse the repository at this point in the history
…dk.Dom into unit-test/rest
  • Loading branch information
recca5p committed Dec 5, 2024
2 parents 95bc453 + a8ad3a0 commit d0378f7
Show file tree
Hide file tree
Showing 19 changed files with 642 additions and 557 deletions.
15 changes: 15 additions & 0 deletions e2e/Sandbox/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Sandbox.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<Sandbox.Properties.Settings>
<setting name="LastSelectedDashboard" serializeAs="String">
<value />
</setting>
</Sandbox.Properties.Settings>
</userSettings>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
10 changes: 10 additions & 0 deletions e2e/Sandbox/DashboardCreators/IDashboardCreator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Reveal.Sdk.Dom;

namespace Sandbox.DashboardFactories
{
interface IDashboardCreator
{
string Name { get; }
RdashDocument CreateDashboard();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Loading

0 comments on commit d0378f7

Please sign in to comment.