Add option to set bar alignment in 'flot-bar-widget' (#2320)

This commit is contained in:
Mirco Pizzichini 2020-02-19 13:47:56 +01:00 committed by GitHub
parent e7dfe75e41
commit 9d6b1c5d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -399,7 +399,8 @@ export default class TbFlot {
options.series.bars ={ options.series.bars ={
show: true, show: true,
lineWidth: 0, lineWidth: 0,
fill: 0.9 fill: 0.9,
align: settings.barAlignment || "left"
} }
ctx.defaultBarWidth = settings.defaultBarWidth || 600; ctx.defaultBarWidth = settings.defaultBarWidth || 600;
} }
@ -975,6 +976,11 @@ export default class TbFlot {
"type": "number", "type": "number",
"default": 600 "default": 600
}; };
properties["barAlignment"] = {
"title": "Bar alignment",
"type": "string",
"default": "left"
};
} }
properties["shadowSize"] = { properties["shadowSize"] = {
"title": "Shadow size", "title": "Shadow size",
@ -1125,6 +1131,25 @@ export default class TbFlot {
} }
if (chartType === 'bar') { if (chartType === 'bar') {
schema["form"].push("defaultBarWidth"); schema["form"].push("defaultBarWidth");
schema["form"].push({
"key": "barAlignment",
"type": "rc-select",
"multiple": false,
"items": [
{
"value": "left",
"label": "Left"
},
{
"value": "right",
"label": "Right"
},
{
"value": "center",
"label": "Center"
}
]
});
} }
schema["form"].push("shadowSize"); schema["form"].push("shadowSize");
schema["form"].push({ schema["form"].push({