labels property
dynamic
labels
Show labels on each data points or set formatter function for data labels. The formatter function receives 4 arguments such as v, id, i, j and it must return a string that will be shown as the label. The arguments are:
- v is the value of the data point where the label is shown.
- id is the id of the data where the label is shown.
- i is the index of the data point where the label is shown.
- j is the sub index of the data point where the label is shown.
Implementation
external dynamic
/*bool|{
/**
* Centerize labels on `bar` shape. (**NOTE:** works only for 'bar' type)
*/
centered?: boolean;
/**
* Set label text colors.
*/
colors?:
| string
| { [key: string]: string }
| ((this: Chart, color: string, d: DataItem) => string);
/**
* The formatter function receives 4 arguments such as v, id, i, j and it **must return a string**(`\n` character will be used as line break) that will be shown as the label.<br><br>
* The arguments are:<br>
* - `v` is the value of the data point where the label is shown.
* - `id` is the id of the data where the label is shown.
* - `i` is the index of the data point where the label is shown.
* - `j` is the sub index of the data point where the label is shown.<br><br>
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
*/
format?: FormatFunction | { [key: string]: FormatFunction };
position?: {
/**
* Set each dataset position, relative the original.
*/
[key: string]:
| {
/**
* x coordinate position, relative the original.
*/
x?: number;
/**
* y coordinate position, relative the original.
*/
y?: number;
}
| {
/**
* x coordinate position, relative the original.
*/
x?: number;
/**
* y coordinate position, relative the original.
*/
y?: number;
};
};
}*/
get labels;
void
labels=(dynamic v)
Implementation
external set labels(
dynamic
/*bool|{
/**
* Centerize labels on `bar` shape. (**NOTE:** works only for 'bar' type)
*/
centered?: boolean;
/**
* Set label text colors.
*/
colors?:
| string
| { [key: string]: string }
| ((this: Chart, color: string, d: DataItem) => string);
/**
* The formatter function receives 4 arguments such as v, id, i, j and it **must return a string**(`\n` character will be used as line break) that will be shown as the label.<br><br>
* The arguments are:<br>
* - `v` is the value of the data point where the label is shown.
* - `id` is the id of the data where the label is shown.
* - `i` is the index of the data point where the label is shown.
* - `j` is the sub index of the data point where the label is shown.<br><br>
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
*/
format?: FormatFunction | { [key: string]: FormatFunction };
position?: {
/**
* Set each dataset position, relative the original.
*/
[key: string]:
| {
/**
* x coordinate position, relative the original.
*/
x?: number;
/**
* y coordinate position, relative the original.
*/
y?: number;
}
| {
/**
* x coordinate position, relative the original.
*/
x?: number;
/**
* y coordinate position, relative the original.
*/
y?: number;
};
};
}*/
v);