Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.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 如何在highchart中切换图例布局_Javascript_Jquery_Html_Highcharts - Fatal编程技术网

Javascript 如何在highchart中切换图例布局

Javascript 如何在highchart中切换图例布局,javascript,jquery,html,highcharts,Javascript,Jquery,Html,Highcharts,我有兴趣更改点击事件的图例布局,如下所示 1st单击水平-底部 2nd单击水平顶部 3rd单击垂直左键 4th单击右键 这里是 我不知道如何做到这一点,这是我迄今为止所尝试的 HTML <script src="http://code.highcharts.com/highcharts.js"></script> <div id="container" style="height: 400px"></div> &

我有兴趣更改点击事件的图例布局,如下所示

1st单击水平-底部

2nd单击水平顶部

3rd单击垂直左键

4th单击右键

这里是

我不知道如何做到这一点,这是我迄今为止所尝试的

HTML

      <script src="http://code.highcharts.com/highcharts.js"></script>
      <div id="container" style="height: 400px"></div>
      <input id='legend' type='button' value='toggle legend'>
您需要使用translsate()函数,该函数允许移动SVG元素,如图例

var legend = chart.legend.group;

        $('#btn').click(function(){
            legend.translate(0,0)
        });

您需要使用translsate()函数,该函数允许移动SVG元素,如图例

var legend = chart.legend.group;

        $('#btn').click(function(){
            legend.translate(0,0)
        });

您需要使用translsate()函数,该函数允许移动SVG元素,如图例

var legend = chart.legend.group;

        $('#btn').click(function(){
            legend.translate(0,0)
        });

您需要使用translsate()函数,该函数允许移动SVG元素,如图例

var legend = chart.legend.group;

        $('#btn').click(function(){
            legend.translate(0,0)
        });
这里有一个方法。我讨厌设置内部
标志,但它似乎工作得很好:

var somePositions = [['center','bottom'],
                     ['center','top'],
                     ['left','middle'],
                     ['right','middle']];

 $('#btn').click(function(){
      posIdx++;
      if (posIdx == 4) posIdx = 0;                
      chart.legend.options.align = somePositions[posIdx][0];
      chart.legend.options.verticalAlign = somePositions[posIdx][1];
      chart.isDirtyLegend = true;
      chart.isDirtyBox = true;
      chart.redraw();
 });
这里有一个方法。我讨厌设置内部
标志,但它似乎工作得很好:

var somePositions = [['center','bottom'],
                     ['center','top'],
                     ['left','middle'],
                     ['right','middle']];

 $('#btn').click(function(){
      posIdx++;
      if (posIdx == 4) posIdx = 0;                
      chart.legend.options.align = somePositions[posIdx][0];
      chart.legend.options.verticalAlign = somePositions[posIdx][1];
      chart.isDirtyLegend = true;
      chart.isDirtyBox = true;
      chart.redraw();
 });
这里有一个方法。我讨厌设置内部
标志,但它似乎工作得很好:

var somePositions = [['center','bottom'],
                     ['center','top'],
                     ['left','middle'],
                     ['right','middle']];

 $('#btn').click(function(){
      posIdx++;
      if (posIdx == 4) posIdx = 0;                
      chart.legend.options.align = somePositions[posIdx][0];
      chart.legend.options.verticalAlign = somePositions[posIdx][1];
      chart.isDirtyLegend = true;
      chart.isDirtyBox = true;
      chart.redraw();
 });
这里有一个方法。我讨厌设置内部
标志,但它似乎工作得很好:

var somePositions = [['center','bottom'],
                     ['center','top'],
                     ['left','middle'],
                     ['right','middle']];

 $('#btn').click(function(){
      posIdx++;
      if (posIdx == 4) posIdx = 0;                
      chart.legend.options.align = somePositions[posIdx][0];
      chart.legend.options.verticalAlign = somePositions[posIdx][1];
      chart.isDirtyLegend = true;
      chart.isDirtyBox = true;
      chart.redraw();
 });


这只是将图例移动到左上角,我想让它向所有4个方向移动,如何做到这一点???正如我在论坛上回答你的一样,我向你介绍了如何实现一个图例,因此你需要计算x/y位置,并使用相同的函数来适应其他位置。我还尝试更改编号
legend.translate([0,1])
legend.translate([0100])
无效我更新了我的exmaple at,似乎可以,但删除了此函数中的数组。好的,是像素还是x和y比例?这只是将legend移到左上角,我希望它向所有4个方向移动。如何做到这一点???正如我在论坛上回答你的,我介绍了如何实现一个,因此,您需要计算x/y位置,并使用相同的函数来适应其他位置。我还尝试更改编号
legend.translate([0,1])
legend.translate([0100])
无效果我更新了我的exmaple at,似乎有效,但是删除这个函数中的数组。好的,是像素还是x和y比例?这只是将图例移到左上角,我想让它向所有4个方向移动,这是怎么做到的???正如我在论坛上回答你的一样,我向你介绍了如何实现一个,因此,您需要计算x/y位置,并使用相同的函数来适应其他位置。我还尝试更改编号
legend.translate([0,1])
legend.translate([0100])
无效果我更新了我的exmaple at,似乎有效,但是删除这个函数中的数组。好的,是像素还是x和y比例?这只是将图例移到左上角,我想让它向所有4个方向移动,这是怎么做到的???正如我在论坛上回答你的一样,我向你介绍了如何实现一个,因此,您需要计算x/y位置,并使用相同的函数来适应其他位置。我还尝试更改编号
legend.translate([0,1])
legend.translate([0100])
无效果我更新了我的exmaple at,似乎有效,但是移除这个函数中的数组。好的,是像素还是x和y比例?你是我的耶稣这次你让我高兴,它像预期的那样工作爱你…非常感谢..马克..你是我的耶稣这次你让我高兴,它像预期的那样工作爱你…非常感谢..马克..你是我的耶稣这次你让我高兴,这是意料中的事爱你…非常感谢马克你是我的耶稣这次你又让我开心了,这是意料中的事爱你…非常感谢马克。。