将系列标记添加到highcharts区域图表

 东cz莞痴 发布于 2023-02-12 11:47

我正在尝试根据时间轴创建一个区域图表,一切正常,直到我添加一个series marker.我尝试了一些不同的模式,但无法使用标记来渲染图表.

尝试1:[x,y][{x,y,marker}]对象替换项目

data: [[1384219800000,2],
[{x:1384269600000,y:7,marker:{symbol:"url(http://www.highcharts.com/demo/gfx/sun.png)"}}],
[1384279900000,1]]

尝试2:[x,y][x, {y,marker}]对象替换项目

data: [[1384219800000,2],
[1384269600000, {y:7,marker:{symbol:"url(http://www.highcharts.com/demo/gfx/sun.png)"}}],
[1384279900000,1]]

这是没有标记的工作区域图.这会呈现正常,直到我尝试添加标记符号

$(function () {
        $('#container').highcharts({
                            chart: {
                    type: 'area'
                },
                title: {
                    style: {
                        display: 'none'
                    }
                },
                subtitle: {
                    style: {
                        display: 'none'
                    }
                },
                credits: {
                    enabled: false
                },
                xAxis: {
                    type: 'datetime'
                },
                yAxis: {
                    title: {
                        text: ''
                    },
                    min: 0,
                    minorGridLineWidth: 0,
                    gridLineWidth: 0,
                    alternateGridColor: null
                },
                legend: {
                    borderWidth: 0,
                    enabled: true,
                    align: 'right',
                    verticalAlign: 'top',
                    x: -5,
                    y: -15,
                    floating: true
                },
                plotOptions: {
                    area: {
                        stacking: 'normal',
                        lineColor: '#666666',
                        lineWidth: 1,
                        marker: {
                            lineWidth: 0,
                            lineColor: '#666666',
                            enabled: false
                        }
                    }
                },
                series:
                [{
                    name: 'Items',
                    color: '#3399CC',
                    data: [[1384219800000,2],[1384269600000,7],[1384279900000,1]]
                }],
                navigation:
                {
                    menuItemStyle: {
                        fontSize: '10px'
                    }
                },
                navigator: {
                    enabled: true
                },
                scrollbar: {
                    enabled: false
                },
                rangeSelector: {
                    enabled: false
                }
        });
    });

Mark.. 5

你的第一个语法是接近正确,除非你需要删除[]围绕{}并启用特定点标记:

data: [
  [1384219800000,2],
  {
    x:1384269600000,
    y:7,
    marker:{
      enabled: true, 
      symbol:"url(http://www.highcharts.com/demo/gfx/sun.png)"
    }
   },
   [1384279900000,1]
]

小提琴这里.

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有