Highcharts Demo

author(s): Torstein Hønsi

by Black Label

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container"></div>
<div id="container2"></div>

JavaScript

var H = Highcharts,
    defined = H.defined,
    pick = H.pick,
    merge = H.merge

H.PlotLineOrBand.prototype.render = function() {
    H.fireEvent(this, 'render');
    var plotLine = this,
        axis = plotLine.axis,
        horiz = axis.horiz,
        options = plotLine.options,
        optionsLabel = options.label,
        label = plotLine.label,
        to = options.to,
        from = options.from,
        value = options.value,
        isBand = defined(from) && defined(to),
        isLine = defined(value),
        svgElem = plotLine.svgElem,
        isNew = !svgElem,
        path = [],
        color = options.color,
        zIndex = pick(options.zIndex, 0),
        events = options.events,
        attribs = {
            'class': 'highcharts-plot-' + (isBand ? 'band ' : 'line ') +
                (options.className || '')
        },
        groupAttribs = {},
        renderer = axis.chart.renderer,
        groupName = isBand ? 'bands' : 'lines',
        group;
    //isInverted

    // logarithmic conversion
    if (axis.isLog) {
        from = axis.log2lin(from);
        to = axis.log2lin(to);
        value = axis.log2lin(value);
    }
    // Set the presentational attributes
    if (!axis.chart.styledMode) {
        if (isLine) {
            attribs.stroke = color || '#999999';
            attribs['stroke-width'] = pick(options.width, 1);
            if (options.dashStyle) {
                attribs.dashstyle =
                    options.dashStyle;
            }
        } else if (isBand) { // plot band
            attribs.fill = color || '#e6ebf5';
            if (options.borderWidth) {
                attribs.stroke = options.borderColor;
                attribs['stroke-width'] = options.borderWidth;
            }
        }
    }
    // Grouping and zIndex
    groupAttribs.zIndex = zIndex;
    groupName += '-' + zIndex;
    group = axis.plotLinesAndBandsGroups[groupName];
    if (!group) {
        axis.plotLinesAndBandsGroups[groupName] = group =
    ...