@forter/chart
Advanced tools
Comparing version 5.7.3 to 5.8.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [5.8.0](https://github.com/forter/web-components/compare/@forter/chart@5.7.3...@forter/chart@5.8.0) (2021-10-13) | ||
### Features | ||
* **chart:** added usage events ([a21af2e](https://github.com/forter/web-components/commit/a21af2e)) | ||
## [5.7.3](https://github.com/forter/web-components/compare/@forter/chart@5.7.2...@forter/chart@5.7.3) (2021-10-04) | ||
@@ -8,0 +19,0 @@ |
import { merge } from 'lodash-es'; | ||
import stripedHTMLLegend from './html-legend-striped.svg.js'; | ||
const onLegendClick = (chart, item) => { | ||
const onLegendClick = (chart, item, context) => { | ||
const { | ||
type | ||
} = chart.config; | ||
const options = { | ||
bubbles: false, | ||
composed: false | ||
}; | ||
context.dispatchEvent(new CustomEvent('chart-legend-click', options)); | ||
@@ -44,3 +49,3 @@ if (type === 'pie' || type === 'doughnut') { | ||
items.forEach((item, index) => { | ||
context.shadowRoot.querySelector(`.legend-item:nth-child(${index + 1})`).addEventListener('click', () => onLegendClick(chart, item)); | ||
context.shadowRoot.querySelector(`.legend-item:nth-child(${index + 1})`).addEventListener('click', () => onLegendClick(chart, item, context)); | ||
}); | ||
@@ -47,0 +52,0 @@ } |
@@ -7,4 +7,10 @@ import { html } from 'lit-element'; | ||
tooltipElement, | ||
canvas | ||
canvas, | ||
previewMode | ||
} = context; | ||
if (previewMode) { | ||
return chartJSConfig; | ||
} | ||
context.tooltipPosition = { | ||
@@ -11,0 +17,0 @@ x: -999, |
@@ -67,2 +67,7 @@ import { defineProperty as _defineProperty } from './_virtual/_rollupPluginBabelHelpers.js'; | ||
value: false | ||
}, | ||
previewMode: { | ||
type: Boolean, | ||
attribute: 'preview-mode', | ||
value: false | ||
} | ||
@@ -69,0 +74,0 @@ }; |
{ | ||
"name": "@forter/chart", | ||
"version": "5.7.3", | ||
"version": "5.8.0", | ||
"description": "chart from Forter Components", | ||
@@ -59,3 +59,3 @@ "author": "Forter Developers", | ||
}, | ||
"gitHead": "186ceb0d2455d42dfaa212e8b0f552eaf307555d" | ||
"gitHead": "338daeeab406c14c3111cfc5e7999370e11be4f0" | ||
} |
@@ -21,10 +21,11 @@ # fc-chart | ||
| Property | Attribute | Type | Default | | ||
|------------------|--------------|-----------|---------| | ||
| `config` | `config` | `{}` | {} | | ||
| `configHash` | `configHash` | `string` | | | ||
| `currentBuilder` | | `any` | | | ||
| `disabled` | `disabled` | `boolean` | false | | ||
| `loading` | `loading` | `boolean` | false | | ||
| `type` | `type` | `string` | "line" | | ||
| Property | Attribute | Type | Default | | ||
|------------------|----------------|-----------|---------| | ||
| `config` | `config` | `{}` | {} | | ||
| `configHash` | `configHash` | `string` | | | ||
| `currentBuilder` | | `any` | | | ||
| `disabled` | `disabled` | `boolean` | false | | ||
| `loading` | `loading` | `boolean` | false | | ||
| `previewMode` | `preview-mode` | `boolean` | false | | ||
| `type` | `type` | `string` | "line" | | ||
@@ -31,0 +32,0 @@ ## CSS Custom Properties |
import { merge } from 'lodash-es'; | ||
import stripedHTMLLegend from './html-legend-striped.svg'; | ||
const onLegendClick = (chart, item) => { | ||
const onLegendClick = (chart, item, context) => { | ||
const { type } = chart.config; | ||
const options = { | ||
bubbles: false, | ||
composed: false, | ||
}; | ||
context.dispatchEvent(new CustomEvent('chart-legend-click', options)); | ||
if (type === 'pie' || type === 'doughnut') { | ||
@@ -45,3 +52,3 @@ // Pie and doughnut charts only have a single dataset and visibility is per item | ||
context.shadowRoot.querySelector(`.legend-item:nth-child(${index + 1})`) | ||
.addEventListener('click', () => onLegendClick(chart, item)); | ||
.addEventListener('click', () => onLegendClick(chart, item, context)); | ||
}); | ||
@@ -48,0 +55,0 @@ } |
@@ -5,4 +5,8 @@ import { get, merge } from 'lodash-es'; | ||
export default (config, chartJSConfig, context) => { | ||
const { tooltipElement, canvas } = context; | ||
const { tooltipElement, canvas, previewMode } = context; | ||
if (previewMode) { | ||
return chartJSConfig; | ||
} | ||
context.tooltipPosition = { | ||
@@ -9,0 +13,0 @@ x: -999, |
@@ -51,3 +51,4 @@ import { LitElement, html } from 'lit-element'; | ||
configHash: { type: String }, | ||
loading: { type: Boolean, value: false } | ||
loading: { type: Boolean, value: false }, | ||
previewMode: { type: Boolean, attribute: 'preview-mode', value: false } | ||
}; | ||
@@ -54,0 +55,0 @@ } |
@@ -28,2 +28,6 @@ { | ||
"type": "boolean" | ||
}, | ||
{ | ||
"name": "preview-mode", | ||
"type": "boolean" | ||
} | ||
@@ -53,2 +57,6 @@ ], | ||
{ | ||
"name": "previewMode", | ||
"type": "boolean" | ||
}, | ||
{ | ||
"name": "currentBuilder", | ||
@@ -55,0 +63,0 @@ "type": "any" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151288
2823
36