Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Highcharts根据图表宽度重新绘制图像_Javascript_Jquery_Html_Highcharts - Fatal编程技术网

Javascript Highcharts根据图表宽度重新绘制图像

Javascript Highcharts根据图表宽度重新绘制图像,javascript,jquery,html,highcharts,Javascript,Jquery,Html,Highcharts,我正在根据一定的宽度在高位图表上重新绘制图像。我取得了一些进步,但我仍然无法在图表中保留的值范围内重新绘制这些图像 我附上了一把小提琴,显示了我的问题。下面的代码也是到目前为止我的解决方案的一部分 //Line 18 redraw: function () { //Gets called when the chart resizes var offset = (750 - chart.chartWidth); initDrawin

我正在根据一定的宽度在高位图表上重新绘制图像。我取得了一些进步,但我仍然无法在图表中保留的值范围内重新绘制这些图像

我附上了一把小提琴,显示了我的问题。下面的代码也是到目前为止我的解决方案的一部分

//Line 18
redraw: function () { //Gets called when the chart resizes
                var offset = (750 - chart.chartWidth);
                initDrawing(chart, offset);
                console.log(offset);
            }

 //Line 96  Call the initDrawing function on initial load so that it draws the arrows
 var offset = (750 - chart.chartWidth);
  initDrawing(chart, offset);

//Line 99, I have to then call init drwaing and pass in the offset so i know how far to redraw. Also i have to remove each of the arrows after each redraw.
    function initDrawing(chart, offset) {

    var renderer = chart.renderer;
    $("#goal1").remove();
    $("#goal2").remove();

这是一个版本的代码,它不是自己进行计算,而是尝试使用
chart.renderer
,将图像添加为客户标记散点图。通过这种方式,highcharts可以为您进行定位计算,而且维护起来更容易:

series: [{
        name: null,
        data: [100, 100, 100, 100],
        color: "#E9E9E9"
    },{
        type: 'scatter',
        data: [[0,75], [1,50], [2,35], [3,65]],
        marker: {
            symbol: 'url(http://i.imgur.com/42P7k7o.png?1)'
        }            
}]  

更新的小提琴。

那么标记应该放在哪里?在百分之X的酒吧?什么不使用自定义系列标记()放置图像?Hi Mark如何使绿色箭头不直接位于条形图上,而是略高于或低于条形图?