agentic-net-examples / working-with-charts
AGENTS.md1 starsChanged 29 days agoMITView on GitHub
Create focused, runnable C# examples for embedded Excel charts and chart sheets. Follow ../AGENTS.md, then this file. Generated examples are discovery material until APIs and results are validated. In scope: chart creation, source/category binding, series, combo charts, secondary axes, titles, legends, labels, trendlines, error bars, layout/style, inspection, update, and chart image/PDF rendering. Out of scope: sparklines, unrelated drawing shapes, tables except as data sources, full-workbook conversion, and formula authoring as the primary goal. Use explicit types, a small deterministic source…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,337 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository32 other files it gives its agents.
- Aspose.Cells for .NET Product AgentAGENTS.md
- calculate-formulas/AGENTS.mdAGENTS.md
- cells-data/AGENTS.mdAGENTS.md
- comments-and-notes/AGENTS.mdAGENTS.md
- conversion/AGENTS.mdAGENTS.md
- document-properties/AGENTS.mdAGENTS.md
- encryption-and-protection/AGENTS.mdAGENTS.md
- format-cells/AGENTS.mdAGENTS.md
- globalization-and-localization/AGENTS.mdAGENTS.md
- macro-project/AGENTS.mdAGENTS.md
- manage-formulas/AGENTS.mdAGENTS.md
- manage-workbook/AGENTS.mdAGENTS.md
- managing-ranges/AGENTS.mdAGENTS.md
- open-workbook/AGENTS.mdAGENTS.md
- pivot-table/AGENTS.mdAGENTS.md
- queries-and-connections/AGENTS.mdAGENTS.md
- rows-and-columns/AGENTS.mdAGENTS.md
- save-workbook/AGENTS.mdAGENTS.md
- slicer/AGENTS.mdAGENTS.md
- smart-markers/AGENTS.mdAGENTS.md
- sparkline/AGENTS.mdAGENTS.md
- timeline/AGENTS.mdAGENTS.md
- workbook-merger/AGENTS.mdAGENTS.md
- working-with-html/AGENTS.mdAGENTS.md
- working-with-images/AGENTS.mdAGENTS.md
- working-with-json/AGENTS.mdAGENTS.md
- working-with-pdf/AGENTS.mdAGENTS.md
- working-with-shapes/AGENTS.mdAGENTS.md
- working-with-tables/AGENTS.mdAGENTS.md
- working-with-worksheets/AGENTS.mdAGENTS.md
- xml-maps/AGENTS.mdAGENTS.md
- llms.txtllms.txt
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Create focused, runnable C# examples for embedded Excel charts and chart sheets.
- Distinctive: line 78
Use sheet-qualified A1 references for cross-sheet data.
- Very specific: line 90
Use Worksheet.Charts.Add to create, NSeries.Add for values, and NSeries.CategoryData for categories.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Aspose.Cells Charts Agent Instructions
Mission and boundary
Create focused, runnable C# examples for embedded Excel charts and chart sheets. Follow ../AGENTS.md, then this file. Generated examples are discovery material until APIs and results are validated.
In scope: chart creation, source/category binding, series, combo charts, secondary axes, titles, legends, labels, trendlines, error bars, layout/style, inspection, update, and chart image/PDF rendering.
Out of scope: sparklines, unrelated drawing shapes, tables except as data sources, full-workbook conversion, and formula authoring as the primary goal.
Canonical answer
using System;
using Aspose.Cells;
using Aspose.Cells.Charts;
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells["A1"].PutValue("Quarter");
worksheet.Cells["B1"].PutValue("Revenue");
worksheet.Cells["A2"].PutValue("Q1");
worksheet.Cells["A3"].PutValue("Q2");
worksheet.Cells["A4"].PutValue("Q3");
worksheet.Cells["B2"].PutValue(120);
worksheet.Cells["B3"].PutValue(180);
worksheet.Cells["B4"].PutValue(150);
int index = worksheet.Charts.Add(ChartType.Column, 1, 3, 16, 11);
Chart chart = worksheet.Charts[index];
chart.Title.Text = "Quarterly Revenue";
chart.NSeries.Add("B2:B4", true);
chart.NSeries.CategoryData = "A2:A4";
chart.NSeries[0].Name = "Revenue";
if (worksheet.Charts.Count != 1 || chart.NSeries.Count != 1)
{
throw new InvalidOperationException("Chart validation failed.");
}
workbook.Save("column-chart.xlsx");
Console.WriteLine("Created column-chart.xlsx with one chart.");API truths and map
| Goal | API |
| Add a chart | ChartCollection.Add |
| Configure chart | Chart |
| Bind/manage series | Chart.NSeries, SeriesCollection |
| Customize a series | Series |
| Axes, labels, legend | Axis, DataLabels, Legend |
| Per-point styling | ChartPoint |
| Render chart | Chart.ToImage, Chart.ToPdf |
- Populate source data before adding and validating the chart.
Charts.Addreturns an index; chart bounds are worksheet row/column anchors.NSeriesis the canonical Aspose.Cells series collection.- Series values and category data are separate ranges.
- Use sheet-qualified A1 references for cross-sheet data.
- Combo charts may use
Series.TypeandPlotOnSecondAxis; verify axis compatibility. - Calculate workbook formulas before chart validation/rendering.
Chart.Calculateconcerns chart layout, not workbook formula calculation.- Rendering depends on fonts; validate nonempty output and semantics before pixel comparisons.
Contract, validation, and safety
Use explicit types, a small deterministic source table, one chart feature, suitable chart type, correct ranges, named output, and metadata. Verify chart/series counts and the changed property, save/reopen, and render only when required. Avoid unbounded points, remote assets, font assumptions, UI claims, and invented properties.
AI retrieval and FAQ
Use Worksheet.Charts.Add to create, NSeries.Add for values, and NSeries.CategoryData for categories. Use PlotOnSecondAxis for a compatible secondary-axis series and Chart.ToImage for chart-only rendering.
Official resources
Definition of done
The example compiles, runs, binds the intended ranges, validates chart semantics and persisted output, and introduces no unrelated charting or UI library.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

