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

Add ability to create variable length'd plot lines #4097

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@okcoker
Copy link

okcoker commented Apr 14, 2015

As of right now plot lines extend the height (or width?) of the chart. In my case I want to be able to control how high the plot lines rise. This simple addition will allow much greater control of that.

An example using this change would be something like:

plotLines:  [{
    value: i,
    width: 1,
    verticalAlign: 'middle',
    color: '#ffffff',
    formatter(path) {
        // path will be in the format of ["M", 108.5, 10, "L", 108.5, 186]
        path[2] = 50 * this.value; // Edit height of lines
        return path; // return new path array
     }
})
@@ -54,6 +55,11 @@ Highcharts.PlotLineOrBand.prototype = {
// plot line
if (width) {
path = axis.getPlotLinePath(value, width);

if (typeof formatter === 'function') {
path = formatter(path);

This comment has been minimized.

@okcoker

okcoker Apr 14, 2015

This should probably be path = formatter.call(context, path). Just not sure what to set the context to.

@okcoker okcoker force-pushed the okcoker:master branch from f20c430 to 670750f Apr 18, 2015

@okcoker okcoker force-pushed the okcoker:master branch from 670750f to 20165ed Apr 18, 2015

@ericmulder

This comment has been minimized.

Copy link

ericmulder commented Feb 11, 2016

Very nice solution, I use it in my project!

@JulianLeviston

This comment has been minimized.

Copy link

JulianLeviston commented Nov 9, 2016

Would love to have this. Sadly we're not on latest highcharts.

@TorsteinHonsi

This comment has been minimized.

Copy link
Collaborator

TorsteinHonsi commented Nov 9, 2016

You can do something similar by wrapping the PlotBandOrLine.prototype.render function : http://jsfiddle.net/highcharts/p7frp7o6/

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