Orkun
Orkun

Reputation: 7248

Highcharts full circle gauge as in Knob js

Is there any simple example (preferibly with a JSFiddle) for an implementation of a full circle gauge with Highcharts like the one below from jQuery knob ?

enter image description here

Here is what I ve got so far : http://jsfiddle.net/skeletorkun/grn5o39e/1/

$(function () {

    var gaugeOptions = {

        chart: {
            type: 'solidgauge'
        },

        title: null,

        pane: {
            center: ['50%', '50%'],
            size: '100%',
            startAngle: 0,
            endAngle: 360,
            background: {
                backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
                innerRadius: '60%',
                outerRadius: '100%',
                shape: 'arc'
            }
        },

        tooltip: {
            enabled: false
        },

        // the value axis
        yAxis: {
            stops: [
                [0.1, '#55BF3B'], // green
                [0.5, '#DDDF0D'], // yellow
                [0.9, '#DF5353'] // red
            ],
            lineWidth: 0,
            minorTickInterval: null,
            tickPixelInterval: 400,
            tickWidth: 0,
            title: {
                y: -70
            },
            labels: {
                y: 16
            }
        },

        plotOptions: {
            solidgauge: {
                dataLabels: {
                    y: 5,
                    borderWidth: 0,
                    useHTML: true
                }
            }
        }
    };


    // The RPM gauge
    $('#container-rpm').highcharts(Highcharts.merge(gaugeOptions, {
        yAxis: {
            min: 0,
            max: 100,
            title: {
                text: 'sth'
            }
        },

        series: [{
            name: 'RPM',
            data: [92],
            dataLabels: {
                format: '<div style="text-align:center"><span style="font-size:25px;color:' +
                    ((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y}</span><br/>'

            },
            tooltip: {
                valueSuffix: ' revolutions/min'
            }
        }]

    }));




});

Upvotes: 1

Views: 5487

Answers (2)

Sebastian Bochan
Sebastian Bochan

Reputation: 37588

You can realise that by solid-gauge and set a correct angles in pane.

pane: {
        center: ['50%', '50%'],
        size: '100%',
        startAngle: 0,
        endAngle: 360,
        background: {
            backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
            innerRadius: '60%',
            outerRadius: '100%',
            shape: 'arc'
        }
    },

Example: http://jsfiddle.net/e76o9otk/1/

Upvotes: 6

Soundar
Soundar

Reputation: 2589

Is jQuery roundSlider suitable for you ?

This was made with div elements only, so very easy to customize and flexible to use.

For more details check the demos page.

Demo on jsFiddle same as your requirement

Upvotes: 1

Related Questions