| [`pointStyle`](#styling) | [`pointStyle`](../configuration/elements.md#types) | Yes | Yes | `'circle'`
| [`rotation`](#styling) | `number` | Yes | Yes | `0`
| [`radius`](#styling) | `number` | Yes | Yes | `3`
+| [`drawActiveElementsOnTop`](#styling) | `boolean` | Yes | Yes | `true`
All these values, if `undefined`, fallback to the scopes described in [option resolution](../general/options)
| `pointStyle` | bubble [shape style](../configuration/elements.md#point-styles).
| `rotation` | bubble rotation (in degrees).
| `radius` | bubble radius (in pixels).
+| `drawActiveElementsOnTop` | Draw the active bubbles of a dataset over the other bubbles of the dataset
All these values, if `undefined`, fallback to the associated [`elements.point.*`](../configuration/elements.md#point-configuration) options.
| [`tension`](#line-styling) | `number` | - | - | `0`
| [`xAxisID`](#general) | `string` | - | - | first x axis
| [`yAxisID`](#general) | `string` | - | - | first y axis
+| [`drawActiveElementsOnTop`](#point-styling) | `boolean` | Yes | Yes | `true`
All these values, if `undefined`, fallback to the scopes described in [option resolution](../general/options)
| `pointRadius` | The radius of the point shape. If set to 0, the point is not rendered.
| `pointRotation` | The rotation of the point in degrees.
| `pointStyle` | Style of the point. [more...](../configuration/elements.md#point-styles)
+| `drawActiveElementsOnTop` | Draw the active points of a dataset over the other points of the dataset
All these values, if `undefined`, fallback first to the dataset options then to the associated [`elements.point.*`](../configuration/elements.md#point-configuration) options.
const active = [];
const start = this._drawStart || 0;
const count = this._drawCount || (elements.length - start);
+ const drawActiveElementsOnTop = this.options.drawActiveElementsOnTop;
let i;
if (meta.dataset) {
if (element.hidden) {
continue;
}
- if (element.active) {
+ if (element.active && drawActiveElementsOnTop) {
active.push(element);
} else {
element.draw(ctx, area);
this.scale = undefined;
this.scales = {};
this.showLine = true;
+ this.drawActiveElementsOnTop = true;
this.describe(_descriptors);
}
--- /dev/null
+module.exports = {
+ config: {
+ type: 'bubble',
+ data: {
+ datasets: [{
+ data: [
+ {x: 1, y: 1, r: 80},
+ {x: 1, y: 1, r: 20}
+ ],
+ drawActiveElementsOnTop: false,
+ backgroundColor: (ctx) => (ctx.dataIndex === 1 ? 'red' : 'blue'),
+ hoverBackgroundColor: 'yellow',
+ hoverRadius: 0,
+ }]
+ },
+ options: {
+ scales: {
+ x: {
+ display: false
+ },
+ y: {
+ display: false
+ },
+ },
+ plugins: {
+ tooltip: false,
+ legend: false
+ },
+ }
+ },
+ options: {
+ canvas: {
+ width: 256,
+ height: 256
+ },
+ async run(chart) {
+ const point = chart.getDatasetMeta(0).data[0];
+ await jasmine.triggerMouseEvent(chart, 'click', {y: point.y, x: point.x + 25});
+ }
+ }
+};
* @default 0
*/
rotation: number;
+ /**
+ * Draw the active elements over the other elements of the dataset,
+ * @default true
+ */
+ drawActiveElementsOnTop: boolean;
}
export interface PointHoverOptions extends CommonHoverOptions {