![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
chartjs-gauge
Advanced tools
Simple gauge chart for Chart.js
yarn add chart.js chartjs-gauge
npm install --save chart.js chartjs-gauge
The gauge chart is based on the Doughnut type. It defines the following additional configuration options. These options are merged with the global chart configuration options, Chart.defaults.global
, to form the options passed to the chart.
Name | Type | Default | Description |
---|---|---|---|
needle.radiusPercentage | number | 2 | Needle circle radius as the percentage of the chart area width. |
needle.widthPercentage | number | 3.2 | Needle width as the percentage of the chart area width. |
needle.lengthPercentage | number | 80 | Needle length as the percentage of the interval between inner radius (0%) and outer radius (100%) of the arc. |
needle.color | Color | 'rgba(0, 0, 0, 1)' | The color of the needle. |
valueLabel.display | boolean | 2 | If true, display the value label. |
valueLabel.formatter | function | Math.round | Returns the string representation of the value as it should be displayed on the chart. |
valueLabel.color | Color | 'rgba(255, 255, 255, 1)' | The text color of the label. |
valueLabel.backgroundColor | Color | 'rgba(0, 0, 0, 1)' | The background color of the label. |
valueLabel.borderRadius | number | 5 | Border radius of the label. |
valueLabel.padding.top | number | 5 | Top padding of the label. |
valueLabel.padding.right | number | 5 | Right padding of the label. |
valueLabel.padding.bottom | number | 5 | Bottom padding of the label. |
valueLabel.padding.left | number | 5 | Left padding of the label. |
valueLabel.bottomMarginPercentage | number | 5 | Bottom margin as the percentage of the chart area width. |
It is common to want to apply a configuration setting to all created gauge charts. The global gauge chart settings are stored in Chart.defaults.gauge
. Changing the global options only affects charts created after the change. Existing charts are not changed.
For example, to configure all line charts with radiusPercentage = 5
you would do:
Chart.defaults.gauge.needle.radiusPercentage = 5;
The gauge chart requires a value to be specified for the dataset. This is used to draw the neeedle for the dataset.
Name | Type | Default |
---|---|---|
value | number | undefined |
var ctx = document.getElementById("canvas").getContext("2d");
var chart = new Chart(ctx, {
type: 'gauge',
data: {
datasets: [{
value: 0.5,
data: [1, 2, 3, 4],
backgroundColor: ['green', 'yellow', 'orange', 'red'],
}]
},
options: {
needle: {
radiusPercentage: 2,
widthPercentage: 3.2,
lengthPercentage: 80,
color: 'rgba(0, 0, 0, 1)'
},
valueLabel: {
display: true,
formatter: (value) => {
return '$' + Math.round(value);
},
color: 'rgba(255, 255, 255, 1)',
backgroundColor: 'rgba(0, 0, 0, 1)',
borderRadius: 5,
padding: {
top: 10,
bottom: 10
}
}
}
});
chartjs-gauge is available under the MIT license.
[0.1.0] - 2019-11-14
FAQs
Gauge chart for chart.js
The npm package chartjs-gauge receives a total of 42 weekly downloads. As such, chartjs-gauge popularity was classified as not popular.
We found that chartjs-gauge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.