Skip to content

Commit

Permalink
Added examples for articles
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-lyagin-aspose committed Jul 29, 2024
1 parent 43a8dcf commit cca0763
Show file tree
Hide file tree
Showing 24 changed files with 398 additions and 0 deletions.
185 changes: 185 additions & 0 deletions Examples/ApiExamples/ApiExamples/LinqTemp/ExReportingEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

/// <summary>
/// A helper method asserting that two files are equal.
/// </summary>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
31 changes: 31 additions & 0 deletions Examples/Data/LINQ/Chart with Changing Axis Titles Data.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
Binary file not shown.
31 changes: 31 additions & 0 deletions Examples/Data/LINQ/Chart with Changing Legend Entries Data.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
Binary file not shown.
31 changes: 31 additions & 0 deletions Examples/Data/LINQ/Chart with Changing Series Colors Data.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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"
}
]
Binary file not shown.
30 changes: 30 additions & 0 deletions Examples/Data/LINQ/Chart with Changing Title Data.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
}
]
}
Loading

0 comments on commit cca0763

Please sign in to comment.