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

Legend with proximate option #8638

Closed
VBIManonmaniM opened this issue Jul 18, 2018 · 4 comments
Closed

Legend with proximate option #8638

VBIManonmaniM opened this issue Jul 18, 2018 · 4 comments
Assignees
Labels

Comments

@VBIManonmaniM
Copy link

@VBIManonmaniM VBIManonmaniM commented Jul 18, 2018

Expected behaviour
Legend with proximate option have to work with all kind of Series Data.

Actual behaviour
But it is not working properly with Series with all null data

Live demo with steps to reproduce
https://jsfiddle.net/v24xsjh8/4/

Product version
Highcharts

Affected browser(s)
All browsers

@pawelfus
Copy link
Contributor

@pawelfus pawelfus commented Jul 18, 2018

Thanks for reporting @VBIManonmaniM !

@pawelfus pawelfus added the Type: Bug label Jul 18, 2018
@pawelfus
Copy link
Contributor

@pawelfus pawelfus commented Jul 18, 2018

Workaround:

Replace current poximate positions:

(function(H) {
  H.Legend.prototype.proximatePositions = function() {
    var chart = this.chart,
      boxes = [],
      alignLeft = this.options.align === 'left';

    H.each(this.allItems, function(item) {
      var lastPoint,
        height,
        useFirstPoint = alignLeft;

      if (item.xAxis && item.points) {

        if (item.xAxis.options.reversed) {
          useFirstPoint = !useFirstPoint;
        }
        lastPoint = H.find(
          useFirstPoint ?
          item.points :
          item.points.slice(0).reverse(),
          function(item) {
            return H.isNumber(item.plotY);
          }
        );
        height = item.legendGroup.getBBox().height;
        boxes.push({
          target: item.visible ?
            (lastPoint && lastPoint.plotY || item.xAxis.height) - 0.3 * height : chart.plotHeight, // Fix #8638
          size: height,
          item: item
        });
      }
    }, this);
    H.distribute(boxes, chart.plotHeight);
    H.each(boxes, function(box) {
      box.item._legendItemPos[1] =
        chart.plotTop - chart.spacing[0] + box.pos;
    });

  }
})(Highcharts);

Demo: http://jsfiddle.net/BlackLabel/h0py3os9/

@VBIManonmaniM
Copy link
Author

@VBIManonmaniM VBIManonmaniM commented Jul 18, 2018

@pawelfus Thank you for your reply, When this fix will release.

@pawelfus pawelfus self-assigned this Jul 19, 2018
pawelfus added a commit that referenced this issue Jul 19, 2018
@pawelfus
Copy link
Contributor

@pawelfus pawelfus commented Jul 19, 2018

Just added PR with fix, if this will get merged into master, then it will be part of v6.1.2 release.

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