在 fusioncharts 中定位 Y 值的注释

问题描述 投票:0回答:1

我需要在柱形图中的每个类别的给定位置放置一条线或矩形。如何根据 Y 轴值将某物放置在某个位置? 例如。 Y 轴的值从 0 到 1500,我想将第一条注释线定位在 200。

只是为了看看它应该是什么样子,这是图表的小提琴,我使用一些列来定位注释线(但我无法隐藏这些列)。 https://jsfiddle.net/21br83pz/

"annotations": {
    "showbelow": "0",
    //Annotations on a chart can be divided across multiple groups for easy management, and manipulation through API
    "groups": [{
      //Each group needs a unique ID
      "id": "Minimi",
      //Under each group, you can define multiple items. Each item is a polygon, text or image - with its own set of parameters.
      "items": [{
            //Each item needs a unique ID
            "id": "minimo-0",
            "type": "line",
            "fillColor": "#6baa01",
            "x": "$xaxis.0.label.0.startx",
            "y": "300",
            "tox": "$xaxis.0.label.0.endx"
        },{
            //Each item needs a unique ID
            "id": "minimo-1",
            "type": "line",
            "fillColor": "#6baa01",
            "x": "$xaxis.0.label.1.startx",
            "y": "300",
            "tox": "$xaxis.0.label.1.endx"
        },{
            //Each item needs a unique ID
            "id": "minimo-2",
            "type": "line",
            "fillColor": "#6baa01",
            "x": "$xaxis.0.label.2.startx",
            "y": "300",
            "tox": "$xaxis.0.label.2.endx"
        },
      ...
      ] // items
    }]
  }
javascript fusioncharts
1个回答
0
投票

您可以使用 y 属性将注释起始位置的 y 坐标设置为图表的最顶部位置(取零)。 使用 toX 属性指定图表最左侧位置(取零)注释结束位置的 x 坐标。

    {
    "chart": {
        ...
    },
    "data": [{
        ...
    }],
    "annotations": {
            ...
        "groups": [{
            "items": [{
                "id": "dyn-labelBG",
                "type": "rectangle",
                "radius": "3",
                "x": "290",
                "y": "60",
                "tox": "390",
                "toy": "90",
                "color": "#0075c2",
                "alpha": "70",
                "origW": "400",
                "origH": "300"
            }]
        }]
    }
}

要了解有关此功能的更多信息,请参阅 - https://www.fusioncharts.com/dev/chart-guide/chart-configurations/annotations/positioning-annotations-using-absolute-values

https://www.fusioncharts.com/dev/chart-guide/chart-configurations/annotations/positioning-annotations-using-macros

这是演示小提琴 - https://jsfiddle.net/fusioncharts/ufgt8a10/

希望这会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.