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

Vector series type - rotationOrigin not working properly. #8690

Closed
wchmiel opened this issue Jul 26, 2018 · 1 comment
Closed

Vector series type - rotationOrigin not working properly. #8690

wchmiel opened this issue Jul 26, 2018 · 1 comment

Comments

@wchmiel
Copy link
Contributor

@wchmiel wchmiel commented Jul 26, 2018

Expected behaviour

When rotationOrigin is set to 'start' vector should start from the given [x, y] position, when set to 'end' it should end there.

Actual behaviour

'start' and 'end' position of rotationOrigin move vector a little bit from it's center.

Live demo with steps to reproduce

https://jsfiddle.net/wchmiel/49yzer1o/

  1. set rotationOrigin to 'start',
  2. set rotationOrigin to 'end'

Product version

Highcharts

Affected browser(s)

all

Suggested solution

start and end should be multiply by u variable:

  H.seriesTypes.vector.prototype.arrow = function(point) {
    var path,
      fraction = point.length / this.lengthMax,
      u = fraction * this.options.vectorLength / 20,
      o = {
        start: 10 * u,   // should be multiply by u
        center: 0,
        end: -10 * u   // should be multiply by u
      }[this.options.rotationOrigin] || 0;

    path = [
      'M', 0, 7 * u + o, // base of arrow
      'L', -1.5 * u, 7 * u + o,
      0, 10 * u + o,
      1.5 * u, 7 * u + o,
      0, 7 * u + o,
      0, -10 * u + o // top
    ];

    return path;
  }

Live demo with suggested solution: https://jsfiddle.net/wchmiel/q43Ldezm/

@TorsteinHonsi
Copy link
Collaborator

@TorsteinHonsi TorsteinHonsi commented Aug 1, 2018

Thanks for the report and the solution! Fix coming up in a minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants