Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to create Solidgauge using highcharts in angular2 #35

Closed
arunsaibk opened this issue Mar 23, 2017 · 7 comments
Closed

Need to create Solidgauge using highcharts in angular2 #35

arunsaibk opened this issue Mar 23, 2017 · 7 comments

Comments

@arunsaibk
Copy link

arunsaibk commented Mar 23, 2017

I successfully able to create line chart but when I am changing chart type to solidgauge , I am getting errors ,

I followed the same steps in npmjs of this library
https://www.npmjs.com/package/angular-highcharts

Please let me know what types i need to import in order to use solidgauge

chart = new Chart({
        chart: {
            type: 'solidgauge',
            marginTop: 50
        },

        title: {
            text: 'Activity',
            style: {
                fontSize: '24px'
            }
        },

        tooltip: {
            borderWidth: 0,
            backgroundColor: 'none',
            shadow: false,
            style: {
                fontSize: '16px'
            },
            pointFormat: '{series.name}<br><span style="font-size:2em; color: {point.color}; font-weight: bold">{point.y}%</span>',
            positioner: function (labelWidth) {
                return {
                    x: 200 - labelWidth / 2,
                    y: 180
                };
            }
        },

        pane: {
            startAngle: 0,
            endAngle: 360,
            background: [{ // Track for Move
                outerRadius: '112%',
                innerRadius: '88%',
                backgroundColor: 'red',
                borderWidth: 0
            }, { // Track for Exercise
                outerRadius: '87%',
                innerRadius: '63%',
                backgroundColor: 'blue',
                borderWidth: 0
            }, { // Track for Stand
                outerRadius: '62%',
                innerRadius: '38%',
                backgroundColor: 'green',
                borderWidth: 0
            }]
        },

        yAxis: {
            min: 0,
            max: 100,
            lineWidth: 0,
            tickPositions: []
        },

        plotOptions: {
            solidgauge: {
                dataLabels: {
                    enabled: false
                },
                linecap: 'round',
                stickyTracking: false

            }
        },
        series: [{
            name: 'Move',
            data: [{
                color: 'red',
                radius: '112%',
                innerRadius: '88%',
                y: 80
            }]
        }, {
            name: 'Exercise',
            data: [{
                color: 'blue',
                radius: '87%',
                innerRadius: '63%',
                y: 65
            }]
        }, {
            name: 'Stand',
            data: [{
                color: 'green',
                radius: '62%',
                innerRadius: '38%',
                y: 50
            }]
        }]
    });
@cebor
Copy link
Owner

cebor commented Mar 23, 2017

Add the following code should fix this:

import { Highcharts } from 'angular-highcharts';
require('highcharts/modules/solid-gauge')(Highcharts);

See: https://github.com/cebor/angular-highcharts#using-highcharts-modules

@arunsaibk
Copy link
Author

@cebor Thanks for your prompt reply, I tried but no luck

My requirement to use exactly this kind of chart using highcharts in angular2 , please let me know what i am missing
http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/gauge-activity/

@cebor
Copy link
Owner

cebor commented Mar 24, 2017

Can you please provide me a plunker using this template: https://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5

So i can reproduce this issue, thanks.

@cebor
Copy link
Owner

cebor commented Mar 24, 2017

Just did it for you: https://plnkr.co/edit/yrPSBbGftdTI8N4lASyG

@arunsaibk
Copy link
Author

arunsaibk commented Mar 24, 2017 via email

@cebor
Copy link
Owner

cebor commented Mar 24, 2017

import { Highcharts } from 'angular-highcharts';
require('highcharts/highcharts-more')(Highcharts);
require('highcharts/modules/solid-gauge')(Highcharts);

This should fix it! I also updated the plunker.

@arunsaibk
Copy link
Author

arunsaibk commented Mar 24, 2017 via email

@cebor cebor closed this as completed Mar 24, 2017
@cebor cebor mentioned this issue Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants