-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add several features for xlsx-chart library #19
base: master
Are you sure you want to change the base?
Conversation
in some cases it was array of chart definitions in some cases it was object: { "bar": true, "radar": true, ... }
"charts.xslx" template is absent in "templates" folder. Current implementation allow to use any template, that have axes, so bar is good enough
before fix zero values also set to empty string, same as values not passed at all
@Tsenzuk Awesome contribution! I've been using some of the features you implemented for a personal project of mine. Upon chart / table export, do you have any idea how to align the table columns, or change the styling of the table headers? I've been sifting through the documentation of DocumentFormat.OpenXml.Spreadsheet but the styling aspects of it are pretty confusing. Thank you! |
@mpaustin1993 yes, it's possible. @vshovkuta investigated this functionality. Here some code examples: var c = [{
$: {
r: "A" + (y + 2),
t: "s",
s: f === "gaugeRestValue" || f === "gaugeDownValue" ? "2" : "0" // here based on f variable we're setting the style with index === 2
},
v: me.getStr (f)
}]; me.read ({file: "xl/styles.xml"}, function (err, o) {
if (err) {
return cb (new VError (err, "writeTableStyle"));
}
o.styleSheet.cellXfs = {
"$": {
"count": "3"
},
"xf": [
{
"$": {
"numFmtId": "0", "fontId": "0", "fillId": "0", "borderId": "0", "xfId": "0"
}
},
{
"$": {
"numFmtId": "0", "fontId": "0", "fillId": "0", "borderId": "0", "xfId": "0", "applyAlignment": "1"
},
"alignment": {
"$": {
"vertical": "bottom", "wrapText": "1"
}
}
},
{ // it's a style added to styles array. It will be applied if it's index is used in "s" field of cell
"$": {
"numFmtId": "0", "fontId": "1", "fillId": "0", "borderId": "0", "xfId": "0", "applyFont": "1"
}
}
]
}
const defaultFont = Object.assign ({}, o.styleSheet.fonts.font);
o.styleSheet.fonts.font = [];
o.styleSheet.fonts.font.push(defaultFont);
const setWhiteColorForFont = Object.assign ({}, defaultFont);
setWhiteColorForFont.color = {
$: {
rgb: "FFFFFFFF",
}
};
o.styleSheet.fonts.font.push(setWhiteColorForFont);
o.styleSheet.fonts.$.count = o.styleSheet.fonts.font.length;
me.write ({file: "xl/styles.xml", object: o});
cb ();
});
}, |
@Tsenzuk & @vshovkuta - thanks a bunch! I'll give this a try & let you know if I have any questions |
can you give me an advise to fix this error? |
@HaiAlison do you use the code from this branch or from the master? if this branch, please also mention, which line it is? Looks like, the object of the chart description inside the |
Oh, I have resolved this bug, thanks for your commit 00bf5ca |
let fs = require ("fs"); let opts = { xlsxChart.generate (opts, function (err, data) { One I changed the column colors its always getting from defult colors Library - rohan |
@rohanke |
you can see the below source I have set colours correctly but its now working as I expected . I only need to change colour of the column. I am almost spent more than 10 hours . Pls help me to figure it out version : "xlsx-chart": "^0.4.3" let fs = require ("fs"); let opts = { xlsxChart.generate (opts, function (err, data) { |
@rohanke you're in the discussion about PR, that still wasn't merged. |
Okey Thank you |
Features that are added in this pr:
config for check: