|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 | 3 | var annAttrs = require('../annotations/attributes');
|
| 4 | +var fontAttrs = require('../../plots/font_attributes'); |
4 | 5 | var scatterLineAttrs = require('../../traces/scatter/attributes').line;
|
5 | 6 | var dash = require('../drawing/attributes').dash;
|
6 | 7 | var extendFlat = require('../../lib/extend').extendFlat;
|
@@ -224,6 +225,85 @@ module.exports = templatedArray('shape', {
|
224 | 225 | '`config.editable` or `config.edits.shapePosition`.'
|
225 | 226 | ].join(' ')
|
226 | 227 | },
|
227 |
| - |
| 228 | + label: { |
| 229 | + text: { |
| 230 | + valType: 'string', |
| 231 | + dflt: '', |
| 232 | + editType: 'arraydraw', |
| 233 | + description: 'Sets the text to display with shape.' |
| 234 | + }, |
| 235 | + font: fontAttrs({ |
| 236 | + editType: 'calc+arraydraw', |
| 237 | + colorEditType: 'arraydraw', |
| 238 | + description: 'Sets the shape label text font.' |
| 239 | + }), |
| 240 | + textposition: { |
| 241 | + valType: 'enumerated', |
| 242 | + values: [ |
| 243 | + 'top left', 'top center', 'top right', |
| 244 | + 'middle left', 'middle center', 'middle right', |
| 245 | + 'bottom left', 'bottom center', 'bottom right', |
| 246 | + 'start', 'middle', 'end', |
| 247 | + ], |
| 248 | + editType: 'arraydraw', |
| 249 | + description: [ |
| 250 | + 'Sets the position of the label text relative to the shape.', |
| 251 | + 'Supported values for rectangles, circles and paths are', |
| 252 | + '*top left*, *top center*, *top right*, *middle left*,', |
| 253 | + '*middle center*, *middle right*, *bottom left*, *bottom center*,', |
| 254 | + 'and *bottom right*.', |
| 255 | + 'Supported values for lines are *start*, *middle*, and *end*.', |
| 256 | + 'Default: *middle center* for rectangles, circles, and paths; *middle* for lines.', |
| 257 | + ].join(' ') |
| 258 | + }, |
| 259 | + textangle: { |
| 260 | + valType: 'angle', |
| 261 | + dflt: 'auto', |
| 262 | + editType: 'calc+arraydraw', |
| 263 | + description: [ |
| 264 | + 'Sets the angle at which the label text is drawn', |
| 265 | + 'with respect to the horizontal. For lines, angle *auto*', |
| 266 | + 'is the same angle as the line. For all other shapes,', |
| 267 | + 'angle *auto* is horizontal.' |
| 268 | + ].join(' ') |
| 269 | + }, |
| 270 | + xanchor: { |
| 271 | + valType: 'enumerated', |
| 272 | + values: ['auto', 'left', 'center', 'right'], |
| 273 | + dflt: 'auto', |
| 274 | + editType: 'calc+arraydraw', |
| 275 | + description: [ |
| 276 | + 'Sets the label\'s horizontal position anchor', |
| 277 | + 'This anchor binds the specified `textposition` to the *left*, *center*', |
| 278 | + 'or *right* of the label text.', |
| 279 | + 'For example, if `textposition` is set to *top right* and', |
| 280 | + '`xanchor` to *right* then the right-most portion of the', |
| 281 | + 'label text lines up with the right-most edge of the', |
| 282 | + 'shape.', |
| 283 | + ].join(' '), |
| 284 | + }, |
| 285 | + yanchor: { |
| 286 | + valType: 'enumerated', |
| 287 | + values: ['top', 'middle', 'bottom'], |
| 288 | + editType: 'calc+arraydraw', |
| 289 | + description: [ |
| 290 | + 'Sets the label\'s vertical position anchor', |
| 291 | + 'This anchor binds the specified `textposition` to the *top*, *middle*', |
| 292 | + 'or *bottom* of the label text.', |
| 293 | + 'For example, if `textposition` is set to *top right* and', |
| 294 | + '`yanchor` to *top* then the top-most portion of the', |
| 295 | + 'label text lines up with the top-most edge of the', |
| 296 | + 'shape.', |
| 297 | + ].join(' ') |
| 298 | + }, |
| 299 | + padding: { |
| 300 | + valType: 'number', |
| 301 | + dflt: 3, |
| 302 | + min: 0, |
| 303 | + editType: 'arraydraw', |
| 304 | + description: 'Sets padding (in px) between edge of label and edge of shape.' |
| 305 | + }, |
| 306 | + editType: 'arraydraw' |
| 307 | + }, |
228 | 308 | editType: 'arraydraw'
|
229 | 309 | });
|
0 commit comments