pandameister / chartjs-chart-radial-gauge

chartjs radial gauge chart implementation
MIT License
27 stars 12 forks source link

Error: "radialGauge" is not a chart type. #1

Closed sante85 closed 5 years ago

sante85 commented 5 years ago

i have copied code pen in angular component and js in angular.json script: []

but this is the error:

Error: "radialGauge" is not a chart type.

pandameister commented 5 years ago

@sante85 do you have a link to your codepen? Seems like the chart type is not being registered, make sure the file https://pandameister.github.io/chartjs-chart-radial-gauge/docs/js/Chart.RadialGauge.umd.js is loaded

sante85 commented 5 years ago

yes, but in typescript you need specify require, and not import (es6 style)

I'll expect that i write:

import as Chart from 'chart.js' import as RadialGauge from 'chartjs-chart-radial-gauge'

instead

const Chart = require('chart.js'); require('chartjs-chart-radial-gauge')

this is old style...

It's clear?

Best regards

pandameister commented 5 years ago

@sante85 Since you're probably not using RadialGauge that import is probably getting stripped away. Try

import 'chartjs-chart-radial-gauge';

See here for a demo: https://stackblitz.com/edit/typescript-pysu6v?file=index.ts

Cheers,

sante85 commented 5 years ago

i'll try

sante85 commented 5 years ago

i can define max value??

pandameister commented 5 years ago

The default domain for the gauge data is [0, 100] but you can specify a different domain in the config, eg:

options: { domain: [0, 1000] }

pandameister commented 5 years ago

closing as it works as expected in typescript