Commit 9d6b1c5d7ae576186d4aebfe497e8681ba280ed2

Authored by Mirco Pizzichini
Committed by GitHub
1 parent e7dfe75e

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

@@ -399,7 +399,8 @@ export default class TbFlot { @@ -399,7 +399,8 @@ export default class TbFlot {
399 options.series.bars ={ 399 options.series.bars ={
400 show: true, 400 show: true,
401 lineWidth: 0, 401 lineWidth: 0,
402 - fill: 0.9 402 + fill: 0.9,
  403 + align: settings.barAlignment || "left"
403 } 404 }
404 ctx.defaultBarWidth = settings.defaultBarWidth || 600; 405 ctx.defaultBarWidth = settings.defaultBarWidth || 600;
405 } 406 }
@@ -975,6 +976,11 @@ export default class TbFlot { @@ -975,6 +976,11 @@ export default class TbFlot {
975 "type": "number", 976 "type": "number",
976 "default": 600 977 "default": 600
977 }; 978 };
  979 + properties["barAlignment"] = {
  980 + "title": "Bar alignment",
  981 + "type": "string",
  982 + "default": "left"
  983 + };
978 } 984 }
979 properties["shadowSize"] = { 985 properties["shadowSize"] = {
980 "title": "Shadow size", 986 "title": "Shadow size",
@@ -1125,6 +1131,25 @@ export default class TbFlot { @@ -1125,6 +1131,25 @@ export default class TbFlot {
1125 } 1131 }
1126 if (chartType === 'bar') { 1132 if (chartType === 'bar') {
1127 schema["form"].push("defaultBarWidth"); 1133 schema["form"].push("defaultBarWidth");
  1134 + schema["form"].push({
  1135 + "key": "barAlignment",
  1136 + "type": "rc-select",
  1137 + "multiple": false,
  1138 + "items": [
  1139 + {
  1140 + "value": "left",
  1141 + "label": "Left"
  1142 + },
  1143 + {
  1144 + "value": "right",
  1145 + "label": "Right"
  1146 + },
  1147 + {
  1148 + "value": "center",
  1149 + "label": "Center"
  1150 + }
  1151 + ]
  1152 + });
1128 } 1153 }
1129 schema["form"].push("shadowSize"); 1154 schema["form"].push("shadowSize");
1130 schema["form"].push({ 1155 schema["form"].push({