Skip to content

Commit

Permalink
feat(gv-chart-gauge): update gauge chart options
Browse files Browse the repository at this point in the history
  • Loading branch information
Okhelifi committed Jun 28, 2021
1 parent 623d65f commit 46a38eb
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/charts/gv-chart-gauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import HCSolidGauge from 'highcharts/modules/solid-gauge';
*
* @attr {number} max - The maximum value of the gauge.
* @attr {Array} series - Array of the series to display.
*
* @attr {Object} tooltip - The list of tooltip attributes to overwrite.
* @attr {Object} pane - The pane serves as a container for axes and backgrounds for circular gauges and polar charts.
*/
export class GvChartGauge extends ChartElement(LitElement) {
constructor() {
Expand All @@ -54,6 +55,7 @@ export class GvChartGauge extends ChartElement(LitElement) {
},
tooltip: {
enabled: false,
...this.tooltip,
},

pane: {
Expand All @@ -67,6 +69,7 @@ export class GvChartGauge extends ChartElement(LitElement) {
borderWidth: 0,
},
],
...this.pane,
},

yAxis: [
Expand Down
49 changes: 49 additions & 0 deletions stories/charts/gv-chart-gauge.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,52 @@ const confWithBackground = {
export const WithColorfulBackground = makeStory(confWithBackground, {
items: [{ series, max: 3 }],
});

const installationsSeries = [
{
name: 'Installations',
data: [
{
color: '#64b5f6',
opacity: 0.8,
radius: '112%',
innerRadius: '88%',
y: 2,
},
],
dataLabels: [
{
enabled: true,
align: 'center',
verticalAlign: 'middle',
format: 'Installations: 3 ',
borderWidth: 0,
style: {
fontSize: '16px',
},
},
],
},
];

const tooltip = {
enabled: true,
distance: 20,
pointFormat: '2 started<br/>1 pending',
nullFormat: 'Value is not available.',
};

const pane = {
background: [
{
outerRadius: '112%',
innerRadius: '88%',
backgroundColor: '#ffb74d80',
borderWidth: 0,
},
],
};

export const witCustomPaneAndTooltip = makeStory(conf, {
items: [{ series: installationsSeries, max: 3, tooltip, pane }],
});

0 comments on commit 46a38eb

Please sign in to comment.