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

New feature: Add icon to tip of gauge pointer #133

Merged
merged 2 commits into from Apr 27, 2017

Conversation

Projects
None yet
3 participants
@dmonaldo
Contributor

dmonaldo commented Apr 25, 2017

You can add an icon (image) to the tip of the gauge pointer with the iconPath and iconScale options. The icon also rotates with the angle of the pointer.

screen shot 2017-04-25 at 3 16 49 am

screen shot 2017-04-25 at 3 19 25 am

// Gauge options
var opts = {
  angle: 0,
  lineWidth: 0.05,
  radiusScale: 0.5,
  pointer: {
    length: 0.5,
    strokeWidth: 0,
    color: '#000000',
    iconPath: 'rocketship.png', // Image path for icon
    iconScale: 0.5 // Relative icon size to image width/height
  }
};
@kplindegaard

Nice feature!
Can I suggest that you add some protection to it before merging? We shouldn't try to draw the image unless @options.iconPath is actually set to something. Just enclose what you added inside an if-block testing if @options.iconPath is provided.

@kplindegaard kplindegaard merged commit 1233639 into bernii:gh-pages Apr 27, 2017

@sirushtij

This comment has been minimized.

Show comment
Hide comment
@sirushtij

sirushtij Mar 29, 2018

How can i add the icon to each gauge bar

sirushtij commented Mar 29, 2018

How can i add the icon to each gauge bar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment