agentleFS
aspose-cellsaspose-cells/agentic-net-examples/working-with-charts/AGENTS.md

agentic-net-examples / working-with-charts

AGENTS.md1 starsChanged 2 months 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…

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
  1. Very specific:

    Create focused, runnable C# examples for embedded Excel charts and chart sheets.

    line 22
  2. Distinctive:

    Use sheet-qualified A1 references for cross-sheet data.

    line 78
  3. Very specific:

    Use Worksheet.Charts.Add to create, NSeries.Add for values, and NSeries.CategoryData for categories.

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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

GoalAPI
Add a chartChartCollection.Add
Configure chartChart
Bind/manage seriesChart.NSeries, SeriesCollection
Customize a seriesSeries
Axes, labels, legendAxis, DataLabels, Legend
Per-point stylingChartPoint
Render chartChart.ToImage, Chart.ToPdf
  • Populate source data before adding and validating the chart.
  • Charts.Add returns an index; chart bounds are worksheet row/column anchors.
  • NSeries is 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.Type and PlotOnSecondAxis; verify axis compatibility.
  • Calculate workbook formulas before chart validation/rendering.
  • Chart.Calculate concerns 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.