Comments (1)
Hi, you can use this code right after chart.Plot()
call:
byte[][] colors = new byte[][] {
new byte[] {127,(byte)255, 127},
new byte[] {(byte)200, (byte)200, (byte)200},
new byte[] {(byte)255,(byte)255, 127},
new byte[] {(byte)255, 127, 127},
new byte[] {(byte)255, 0, 0},
new byte[] {0, (byte)255, 0},
new byte[] {0, 0, (byte)255},
new byte[] {80, 80, 80},
new byte[] {90, 80, 80},
new byte[] {100, 80, 80}
};
int pointCount = serie.GetCategoryAxisData().PointCount;
var plotArea = chart.GetCTChart().plotArea;
plotArea.barChart[0].ser[0].dPt = new System.Collections.Generic.List<NPOI.OpenXmlFormats.Dml.Chart.CT_DPt>();
for (int i = 0; i < pointCount; i++)
{
plotArea.barChart[0].ser[0].dPt.Add(new NPOI.OpenXmlFormats.Dml.Chart.CT_DPt());
plotArea.barChart[0].ser[0].dPt[i].idx = new NPOI.OpenXmlFormats.Dml.Chart.CT_UnsignedInt() { val = (uint)i};
plotArea.barChart[0].ser[0].dPt[i].spPr = new NPOI.OpenXmlFormats.Dml.Chart.CT_ShapeProperties();
plotArea.barChart[0].ser[0].dPt[i].spPr.AddNewSolidFill().AddNewSrgbClr().val = colors[i];
}
You can also use theme colors:
chart.GetCTChart().plotArea.barChart[0].varyColors = new NPOI.OpenXmlFormats.Dml.Chart.CT_Boolean() { val = 1 };
from npoi.
Related Issues (20)
- Charts Not Copied HOT 12
- Saving a Workbook and Re-opening It Corrupts the File HOT 13
- Error 0x800A03EC when opening with Excel.Application after saving with NPOI HOT 5
- Overwrite existing Excel results in problem with content HOT 3
- How can protected workbook excel file with npoi HOT 3
- Formula openxml gets corrupted after opened and saved by NPOI 2.7.0 HOT 12
- Excel file is always modified even if only opened for reading HOT 1
- Can't copy sheet's chart when using sheet copy function HOT 1
- System.Runtime.CompilerServices.Unsafe 4.0.41 not found while calling AsSpan HOT 13
- TypeLoadException: “NPOI.XSSF.UserModel.XSSFSheet.RemoveDataValidation” hasn't been implemented in “NPOI.OOXML, Version=2.7.0.0," HOT 1
- Add API for SearchText for xlsx,xls HOT 4
- Reading large files HOT 3
- AVERAGEIF formula doesn't work in xls HOT 7
- Cells with Formulas Display as Blank HOT 3
- XWPF POI Bug Migration II
- How can set picture properties on "Move and size with cells" HOT 2
- XSSFSheet.CopySheet doesn't support cloning charts
- i cannot open a file with npoi HOT 5
- The npoi package conflicts with the Magicodes.IE package HOT 2
- 'Object reference not set to an instance of an object' in XSSFCell.ToString() HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from npoi.