2016-12-20 4 views

答えて

1

上の写真のようないくつかの矢印を取得したいです。カスタムシェイプのレンダリングはrendererで行うことができます。

extend Highchartsまた、軸線を描画するメソッドが変更されるようにすることもできます。

単純化された拡張機能は、次のようになります。矢印を充填するための

Highcharts.wrap(Highcharts.Axis.prototype, 'getLinePath', function(p, lineWidth) { 
var linePath = p.call(this, lineWidth); 

if (this.options.arrowOnEnd) { 
    var arrowFactor = 20, 
    x, 
    y, 
    arrowPath, 
    newPath; 

    if (this.horiz) { 
    x = linePath[4] = linePath[4] - arrowFactor; 
    y = linePath[5]; 

    arrowPath = [ 
     'L', x - 0.35 * arrowFactor, y - 0.35 * arrowFactor, 
     'L', x + 1 * arrowFactor, y, 
     'L', x - 0.35 * arrowFactor, y + 0.35 * arrowFactor, 
     'L', x, y 
    ]; 
    newPath = linePath.concat(arrowPath); 
    } else { 
    x = linePath[1]; 
    y = linePath[2] = linePath[2]; // + arrowFactor; 

    arrowPath = [ 
     'M', x, y, 
     'L', x - 0.35 * arrowFactor, y + 0.35 * arrowFactor, 
     'L', x, y - 1 * arrowFactor, 
     'L', x + 0.35 * arrowFactor, y + 0.35 * arrowFactor, 
     'L', x, y 
    ]; 

    newPath = arrowPath.concat(linePath); 
    } 

    return newPath; 
} 

return linePath; 
}); 

CSS:

.highcharts-axis-line { 
    fill: black; 
    stroke-linejoin: round; 
} 

例:多く、それは魔法のように動作http://jsfiddle.net/z2aagpeu/

+0

感謝を! – Mina

関連する問題