diff --git a/Examples/ApiExamples/ApiExamples/LinqTemp/ExReportingEngine.cs b/Examples/ApiExamples/ApiExamples/LinqTemp/ExReportingEngine.cs index 480438d9..ec32759f 100644 --- a/Examples/ApiExamples/ApiExamples/LinqTemp/ExReportingEngine.cs +++ b/Examples/ApiExamples/ApiExamples/LinqTemp/ExReportingEngine.cs @@ -453,6 +453,191 @@ public void BuildingComboChart() CompareDocs("Combo Chart Report.docx", "Combo Chart Report Gold.docx"); } + [Test] + public void BuildingGaugeChart() + { + //ExStart:BuildingGaugeChart + //GistId:45e82d351f10b65ceca440d95d72aa5a + // Open the template document. + Document doc = new Document(MyLinqDir + "Gauge Chart Template.docx"); + + // Open the data source file. + JsonDataSource dataSource = new JsonDataSource(MyLinqDir + "Gauge Chart Data.json"); + + // Build a report. + ReportingEngine engine = new ReportingEngine(); + engine.BuildReport(doc, dataSource); + + // Save the report. + doc.Save(ArtifactsDir + "Gauge Chart Report.docx"); + //ExEnd:BuildingGaugeChart + + // Test the report. + CompareDocs("Gauge Chart Report.docx", "Gauge Chart Report Gold.docx"); + } + + [Test] + public void BuildingChartWithVariableNumberOfSeries1() + { + //ExStart:BuildingChartWithVariableNumberOfSeries + //GistId:2f7a15f32189afa4c8a2195926cedf7d + // Open the template document. + Document doc = new Document(MyLinqDir + "Chart with Variable Number of Series Template.docx"); + + // Open the data source file. + JsonDataSource dataSource = new JsonDataSource(MyLinqDir + "Chart with Variable Number of Series Data 1.json"); + + // Build a report. The name of the data source should match the one used in the template. + ReportingEngine engine = new ReportingEngine(); + engine.BuildReport(doc, dataSource, "data"); + + // Save the report. + doc.Save(ArtifactsDir + "Chart with Variable Number of Series Report 1.docx"); + //ExEnd:BuildingChartWithVariableNumberOfSeries + + // Test the report. + CompareDocs("Chart with Variable Number of Series Report 1.docx", + "Chart with Variable Number of Series Report 1 Gold.docx"); + } + + [Test] + public void BuildingChartWithVariableNumberOfSeries2() + { + // Open the template document. + Document doc = new Document(MyLinqDir + "Chart with Variable Number of Series Template.docx"); + + // Open the data source file. + JsonDataSource dataSource = new JsonDataSource(MyLinqDir + "Chart with Variable Number of Series Data 2.json"); + + // Build a report. The name of the data source should match the one used in the template. + ReportingEngine engine = new ReportingEngine(); + engine.BuildReport(doc, dataSource, "data"); + + // Save the report. + doc.Save(ArtifactsDir + "Chart with Variable Number of Series Report 2.docx"); + + // Test the report. + CompareDocs("Chart with Variable Number of Series Report 2.docx", + "Chart with Variable Number of Series Report 2 Gold.docx"); + } + + [Test] + public void ChangingChartTitle() + { + //ExStart:ChangingChartTitle + //GistId:86abd6970b9db97fa6b8a1a5852ac2fc + // Open the template document. + Document doc = new Document(MyLinqDir + "Chart with Changing Title Template.docx"); + + // Open the data source file. + JsonDataSource dataSource = new JsonDataSource(MyLinqDir + "Chart with Changing Title Data.json"); + + // Build a report. + ReportingEngine engine = new ReportingEngine(); + engine.BuildReport(doc, dataSource); + + // Save the report. + doc.Save(ArtifactsDir + "Chart with Changing Title Report.docx"); + //ExEnd:ChangingChartTitle + + // Test the report. + CompareDocs("Chart with Changing Title Report.docx", "Chart with Changing Title Report Gold.docx"); + } + + [Test] + public void ChangingChartLegendEntry() + { + //ExStart:ChangingChartLegendEntry + //GistId:ad4fcc877c14e6d4bd7346fce06d027a + // Open the template document. + Document doc = new Document(MyLinqDir + "Chart with Changing Legend Entries Template.docx"); + + // Open the data source file. + JsonDataSource dataSource = new JsonDataSource(MyLinqDir + "Chart with Changing Legend Entries Data.json"); + + // Build a report. The name of the data source should match the one used in the template. + ReportingEngine engine = new ReportingEngine(); + engine.BuildReport(doc, dataSource, "data"); + + // Save the report. + doc.Save(ArtifactsDir + "Chart with Changing Legend Entries Report.docx"); + //ExEnd:ChangingChartLegendEntry + + // Test the report. + CompareDocs("Chart with Changing Legend Entries Report.docx", + "Chart with Changing Legend Entries Report Gold.docx"); + } + + [Test] + public void ChangingChartAxisTitle() + { + //ExStart:ChangingChartAxisTitle + //GistId:e9668c5d7f03033c56bea98921f80e72 + // Open the template document. + Document doc = new Document(MyLinqDir + "Chart with Changing Axis Titles Template.docx"); + + // Open the data source file. + JsonDataSource dataSource = new JsonDataSource(MyLinqDir + "Chart with Changing Axis Titles Data.json"); + + // Build a report. The name of the data source should match the one used in the template. + ReportingEngine engine = new ReportingEngine(); + engine.BuildReport(doc, dataSource, "data"); + + // Save the report. + doc.Save(ArtifactsDir + "Chart with Changing Axis Titles Report.docx"); + //ExEnd:ChangingChartAxisTitle + + // Test the report. + CompareDocs("Chart with Changing Axis Titles Report.docx", "Chart with Changing Axis Titles Report Gold.docx"); + } + + [Test] + public void ChangingChartSeriesColor() + { + //ExStart:ChangingChartSeriesColor + //GistId:f9a631509dab79e8cc36f2905c8e17d2 + // Open the template document. + Document doc = new Document(MyLinqDir + "Chart with Changing Series Colors Template.docx"); + + // Open the data source file. + JsonDataSource dataSource = new JsonDataSource(MyLinqDir + "Chart with Changing Series Colors Data.json"); + + // Build a report. The name of the data source should match the one used in the template. + ReportingEngine engine = new ReportingEngine(); + engine.BuildReport(doc, dataSource, "data"); + + // Save the report. + doc.Save(ArtifactsDir + "Chart with Changing Series Colors Report.docx"); + //ExEnd:ChangingChartSeriesColor + + // Test the report. + CompareDocs("Chart with Changing Series Colors Report.docx", "Chart with Changing Series Colors Report Gold.docx"); + } + + [Test] + public void ChangingChartSeriesPointColor() + { + //ExStart:ChangingChartSeriesPointColor + //GistId:efa74853ed5a592fa775479b0b480651 + // Open the template document. + Document doc = new Document(MyLinqDir + "Chart with Changing Series Point Colors Template.docx"); + + // Open the data source file. + JsonDataSource dataSource = new JsonDataSource(MyLinqDir + "Chart with Changing Series Point Colors Data.json"); + + // Build a report. The name of the data source should match the one used in the template. + ReportingEngine engine = new ReportingEngine(); + engine.BuildReport(doc, dataSource, "items"); + + // Save the report. + doc.Save(ArtifactsDir + "Chart with Changing Series Point Colors Report.docx"); + //ExEnd:ChangingChartSeriesPointColor + + // Test the report. + CompareDocs("Chart with Changing Series Point Colors Report.docx", + "Chart with Changing Series Point Colors Report Gold.docx"); + } + /// /// A helper method asserting that two files are equal. /// diff --git a/Examples/Data/Golds/LINQ/Chart with Changing Axis Titles Report Gold.docx b/Examples/Data/Golds/LINQ/Chart with Changing Axis Titles Report Gold.docx new file mode 100644 index 00000000..f0f5ea80 Binary files /dev/null and b/Examples/Data/Golds/LINQ/Chart with Changing Axis Titles Report Gold.docx differ diff --git a/Examples/Data/Golds/LINQ/Chart with Changing Legend Entries Report Gold.docx b/Examples/Data/Golds/LINQ/Chart with Changing Legend Entries Report Gold.docx new file mode 100644 index 00000000..edb6cabf Binary files /dev/null and b/Examples/Data/Golds/LINQ/Chart with Changing Legend Entries Report Gold.docx differ diff --git a/Examples/Data/Golds/LINQ/Chart with Changing Series Colors Report Gold.docx b/Examples/Data/Golds/LINQ/Chart with Changing Series Colors Report Gold.docx new file mode 100644 index 00000000..80859d52 Binary files /dev/null and b/Examples/Data/Golds/LINQ/Chart with Changing Series Colors Report Gold.docx differ diff --git a/Examples/Data/Golds/LINQ/Chart with Changing Series Point Colors Report Gold.docx b/Examples/Data/Golds/LINQ/Chart with Changing Series Point Colors Report Gold.docx new file mode 100644 index 00000000..f1440baa Binary files /dev/null and b/Examples/Data/Golds/LINQ/Chart with Changing Series Point Colors Report Gold.docx differ diff --git a/Examples/Data/Golds/LINQ/Chart with Changing Title Report Gold.docx b/Examples/Data/Golds/LINQ/Chart with Changing Title Report Gold.docx new file mode 100644 index 00000000..a8680f9f Binary files /dev/null and b/Examples/Data/Golds/LINQ/Chart with Changing Title Report Gold.docx differ diff --git a/Examples/Data/Golds/LINQ/Chart with Variable Number of Series Report 1 Gold.docx b/Examples/Data/Golds/LINQ/Chart with Variable Number of Series Report 1 Gold.docx new file mode 100644 index 00000000..f7306e93 Binary files /dev/null and b/Examples/Data/Golds/LINQ/Chart with Variable Number of Series Report 1 Gold.docx differ diff --git a/Examples/Data/Golds/LINQ/Chart with Variable Number of Series Report 2 Gold.docx b/Examples/Data/Golds/LINQ/Chart with Variable Number of Series Report 2 Gold.docx new file mode 100644 index 00000000..0d29940b Binary files /dev/null and b/Examples/Data/Golds/LINQ/Chart with Variable Number of Series Report 2 Gold.docx differ diff --git a/Examples/Data/Golds/LINQ/Gauge Chart Report Gold.docx b/Examples/Data/Golds/LINQ/Gauge Chart Report Gold.docx new file mode 100644 index 00000000..41e3631e Binary files /dev/null and b/Examples/Data/Golds/LINQ/Gauge Chart Report Gold.docx differ diff --git a/Examples/Data/LINQ/Chart with Changing Axis Titles Data.json b/Examples/Data/LINQ/Chart with Changing Axis Titles Data.json new file mode 100644 index 00000000..d52a44a3 --- /dev/null +++ b/Examples/Data/LINQ/Chart with Changing Axis Titles Data.json @@ -0,0 +1,31 @@ +{ + "xAxis": "Product Teams", + "yAxis": "Q1 Tasks", + "items": [ + { + "team": "Product Development", + "tasksCompleted": 15, + "tasksPending": 5 + }, + { + "team": "Customer Support", + "tasksCompleted": 100, + "tasksPending": 50 + }, + { + "team": "Quality Assurance", + "tasksCompleted": 200, + "tasksPending": 100 + }, + { + "team": "Operations Management", + "tasksCompleted": 20, + "tasksPending": 10 + }, + { + "team": "Marketing Strategy", + "tasksCompleted": 30, + "tasksPending": 20 + } + ] +} \ No newline at end of file diff --git a/Examples/Data/LINQ/Chart with Changing Axis Titles Template.docx b/Examples/Data/LINQ/Chart with Changing Axis Titles Template.docx new file mode 100644 index 00000000..132af53e Binary files /dev/null and b/Examples/Data/LINQ/Chart with Changing Axis Titles Template.docx differ diff --git a/Examples/Data/LINQ/Chart with Changing Legend Entries Data.json b/Examples/Data/LINQ/Chart with Changing Legend Entries Data.json new file mode 100644 index 00000000..6de66b35 --- /dev/null +++ b/Examples/Data/LINQ/Chart with Changing Legend Entries Data.json @@ -0,0 +1,31 @@ +{ + "series1": "Q1 Revenue", + "series2": "Q1 Expenses", + "items": [ + { + "region": "North", + "revenue": 100000, + "expenses": 60000 + }, + { + "region": "South", + "revenue": 80000, + "expenses": 50000 + }, + { + "region": "East", + "revenue": 60000, + "expenses": 40000 + }, + { + "region": "West", + "revenue": 70000, + "expenses": 45000 + }, + { + "region": "Central", + "revenue": 50000, + "expenses": 30000 + } + ] +} \ No newline at end of file diff --git a/Examples/Data/LINQ/Chart with Changing Legend Entries Template.docx b/Examples/Data/LINQ/Chart with Changing Legend Entries Template.docx new file mode 100644 index 00000000..7bb4fbbe Binary files /dev/null and b/Examples/Data/LINQ/Chart with Changing Legend Entries Template.docx differ diff --git a/Examples/Data/LINQ/Chart with Changing Series Colors Data.json b/Examples/Data/LINQ/Chart with Changing Series Colors Data.json new file mode 100644 index 00000000..df17ddae --- /dev/null +++ b/Examples/Data/LINQ/Chart with Changing Series Colors Data.json @@ -0,0 +1,31 @@ +{ + "color1": "#33ff77", + "color2": "#ffb3b3", + "items": [ + { + "project": "Project A", + "revenue": 95000, + "expenses": 72000 + }, + { + "project": "Project B", + "revenue": 87000, + "expenses": 59000 + }, + { + "project": "Project C", + "revenue": 73000, + "expenses": 45000 + }, + { + "project": "Project D", + "revenue": 70000, + "expenses": 40000 + }, + { + "project": "Project E", + "revenue": 63000, + "expenses": 39000 + } + ] +} \ No newline at end of file diff --git a/Examples/Data/LINQ/Chart with Changing Series Colors Template.docx b/Examples/Data/LINQ/Chart with Changing Series Colors Template.docx new file mode 100644 index 00000000..9b929cd1 Binary files /dev/null and b/Examples/Data/LINQ/Chart with Changing Series Colors Template.docx differ diff --git a/Examples/Data/LINQ/Chart with Changing Series Point Colors Data.json b/Examples/Data/LINQ/Chart with Changing Series Point Colors Data.json new file mode 100644 index 00000000..bb11d380 --- /dev/null +++ b/Examples/Data/LINQ/Chart with Changing Series Point Colors Data.json @@ -0,0 +1,27 @@ +[ + { + "category": "SaaS", + "marketShare": 30, + "color": "#80ffd4" + }, + { + "category": "PaaS", + "marketShare": 25, + "color": "#80aaff" + }, + { + "category": "IaaS", + "marketShare": 20, + "color": "#ffb3ff" + }, + { + "category": "On-Premises Software", + "marketShare": 15, + "color": "#ffbb99" + }, + { + "category": "Open Source Software", + "marketShare": 10, + "color": "#ffd966" + } +] \ No newline at end of file diff --git a/Examples/Data/LINQ/Chart with Changing Series Point Colors Template.docx b/Examples/Data/LINQ/Chart with Changing Series Point Colors Template.docx new file mode 100644 index 00000000..8d464448 Binary files /dev/null and b/Examples/Data/LINQ/Chart with Changing Series Point Colors Template.docx differ diff --git a/Examples/Data/LINQ/Chart with Changing Title Data.json b/Examples/Data/LINQ/Chart with Changing Title Data.json new file mode 100644 index 00000000..3edbb5c3 --- /dev/null +++ b/Examples/Data/LINQ/Chart with Changing Title Data.json @@ -0,0 +1,30 @@ +{ + "title": "Q1 Sales", + "items": [ + { + "product": "Laptops", + "sales": 80000, + "expenses": 60000 + }, + { + "product": "Smartphones", + "sales": 110000, + "expenses": 75000 + }, + { + "product": "Tablets", + "sales": 30000, + "expenses": 20000 + }, + { + "product": "Desktops", + "sales": 50000, + "expenses": 35000 + }, + { + "product": "Accessories", + "sales": 20000, + "expenses": 10000 + } + ] +} \ No newline at end of file diff --git a/Examples/Data/LINQ/Chart with Changing Title Template.docx b/Examples/Data/LINQ/Chart with Changing Title Template.docx new file mode 100644 index 00000000..e41e9476 Binary files /dev/null and b/Examples/Data/LINQ/Chart with Changing Title Template.docx differ diff --git a/Examples/Data/LINQ/Chart with Variable Number of Series Data 1.json b/Examples/Data/LINQ/Chart with Variable Number of Series Data 1.json new file mode 100644 index 00000000..e315a105 --- /dev/null +++ b/Examples/Data/LINQ/Chart with Variable Number of Series Data 1.json @@ -0,0 +1,30 @@ +{ + "hidePending": false, + "items": [ + { + "project": "Project A", + "tasksCompleted": 80, + "tasksPending": 20 + }, + { + "project": "Project B", + "tasksCompleted": 70, + "tasksPending": 30 + }, + { + "project": "Project C", + "tasksCompleted": 85, + "tasksPending": 15 + }, + { + "project": "Project D", + "tasksCompleted": 75, + "tasksPending": 25 + }, + { + "project": "Project E", + "tasksCompleted": 90, + "tasksPending": 10 + } + ] +} \ No newline at end of file diff --git a/Examples/Data/LINQ/Chart with Variable Number of Series Data 2.json b/Examples/Data/LINQ/Chart with Variable Number of Series Data 2.json new file mode 100644 index 00000000..41e33d71 --- /dev/null +++ b/Examples/Data/LINQ/Chart with Variable Number of Series Data 2.json @@ -0,0 +1,30 @@ +{ + "hidePending": true, + "items": [ + { + "project": "Project A", + "tasksCompleted": 80, + "tasksPending": 20 + }, + { + "project": "Project B", + "tasksCompleted": 70, + "tasksPending": 30 + }, + { + "project": "Project C", + "tasksCompleted": 85, + "tasksPending": 15 + }, + { + "project": "Project D", + "tasksCompleted": 75, + "tasksPending": 25 + }, + { + "project": "Project E", + "tasksCompleted": 90, + "tasksPending": 10 + } + ] +} \ No newline at end of file diff --git a/Examples/Data/LINQ/Chart with Variable Number of Series Template.docx b/Examples/Data/LINQ/Chart with Variable Number of Series Template.docx new file mode 100644 index 00000000..7a8ad973 Binary files /dev/null and b/Examples/Data/LINQ/Chart with Variable Number of Series Template.docx differ diff --git a/Examples/Data/LINQ/Gauge Chart Data.json b/Examples/Data/LINQ/Gauge Chart Data.json new file mode 100644 index 00000000..598f4896 --- /dev/null +++ b/Examples/Data/LINQ/Gauge Chart Data.json @@ -0,0 +1,3 @@ +{ + "pointer": 87 +} \ No newline at end of file diff --git a/Examples/Data/LINQ/Gauge Chart Template.docx b/Examples/Data/LINQ/Gauge Chart Template.docx new file mode 100644 index 00000000..66ad42d4 Binary files /dev/null and b/Examples/Data/LINQ/Gauge Chart Template.docx differ