Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.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
向Highcharts中的图表添加多文本的问题_Highcharts - Fatal编程技术网

向Highcharts中的图表添加多文本的问题

向Highcharts中的图表添加多文本的问题,highcharts,Highcharts,你能看一下并让我知道为什么我不能在一个函数中向图表添加多个文本吗 我使用了这个函数 function(chart) { chart.renderer.text('Papa 1', 90, 60) chart.renderer.text('Papa 2', 140, 90) .attr({ rotation: -0 }) .css({

你能看一下并让我知道为什么我不能在一个函数中向图表添加多个文本吗

我使用了这个函数

function(chart) { 
       chart.renderer.text('Papa 1', 90, 60)
       chart.renderer.text('Papa 2', 140, 90)
            .attr({
                rotation: -0
            })
            .css({
                color: '#B8B6B6',
                fontSize: '12px'
            })
            .add();
    });

但它只是将最后一段文字添加到图表中。您能告诉我为什么会发生这种情况,以及我如何将这两个文本(或两个以上文本)都添加到图表中吗?

您忘了添加第一个文本。将第一个文本更改为:
chart.renderer.text('Papa 1',90,60).add()

function(chart) { 
       chart.renderer.text('Papa 1', 90, 60).add();
       chart.renderer.text('Papa 2', 140, 90)
            .attr({
                rotation: -0
            })
            .css({
                color: '#B8B6B6',
                fontSize: '12px'
            })
            .add();
    });