散点图:如何将系列的名称转换为函数

Scatter plot: How to get the name of the series into a function

本文关键字:转换 函数 系列 散点图      更新时间:2023-09-26

所以我想调用这组数据中的"name",以便在脚本的另一部分的函数中使用。

我可以通过使用

调用ticker, x, info和hover变量

event.point。股票,event.point.info

但是我不知道怎么得到这个系列的名字。我试过很多方法,比如……

series.name、this.series.name和event.point.name、this.chart.name

都无济于事。这里是数据

series: 
[{
    name: 'Weak Outlook',color: 'red',data: 
    [{
        x: 40,
        y:10,
        ticker:'Michael Kors: (KORS)',
        info: 'Outlook roughly inline<br>1Q Revenue below street expectations', hover:'Guidance slightly below consensus<br>1Q Revenue to disappoint<br><a href="">read more</a>'
    },
    {
        x: 20,
        y:50,
        ticker:'Shares to sell off on earnings',
        info:'Data implies that shares, after management releases Q1 guidance, will...<br><br><a href="">read more</a>'
    },
    {
        x:0,y:0,ticker:'Zynga: (ZNGA)'
    },
    {
        x:3,y:4,ticker:'Avid: (AVID)'
    },
    {
        x:4,y:10,ticker:'JCPenny: (JCP)'
    },
    {
        x:6,y:25,ticker:'Deckers Outdoor: (DECK)'},
    {
        x:0,y:100,ticker:'Nutrisystem Corp: (NTRI)'
    },
]}],

这里是不工作的函数,请注意,我正在传递事件和系列作为参数,我使用"series.name"来尝试获取系列的名称…这似乎不起作用

click: function(event,series) 
{
    xmlhttp.open("GET","/s.php?o="+event.point.ticker+"&q="+event.point.y+"&r="+event.point.x+"&s="+event.point.info+"&t="+series.name+"&u="+event.point.str5+"&v="+event.point.str6,true);

您想要event.point.series.name每个点都包含对其父系列的引用

    <
  • 系列API/gh><
  • 点API/gh>