HighCharts:在单个系列中绘制多个细分? [英] HighCharts: draw multiple segments in a single serie?

查看:97
本文介绍了HighCharts:在单个系列中绘制多个细分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问自己,是否可以做重叠的多行(在单个系列中)。
我找不到任何例子:(

i'm asking myself if it's possible to do multiple lines (in a single serie) that are overlapping. I couldn't find any example for that :(

我不想这样: Highcharts / Highstock步行没有垂直转换行?

如果我有一组像这样的值:

If i have a set of value like that:

serie1 = [
     [{x:5, y: 10}, {x:7, y: 10}], # segment 1
     [{x:2, y: 12}, {x:9, y: 12}], # segment 2

] 



我想绘制两个在同一系列中的行,可以从交互性(例如传说)中受益。

I want to plot both lines which are in the same series so i can benefit from the interactivity (legend for example).

 y
 ^ 
 |
 |    ------------------segment2-------------------
 |           -----------segment1-------------
 |
 |---2-------5-------------------------------7-----9----------> x
        ______________________
        |                    |
        | Legend: - serie 1  |
        |____________________|                (I'm proud of my ASCII skills ! :D)

这是可能吗?感谢

推荐答案

通常,每个系列都需要按x值排序数据。在你的情况下,它不会被排序。因此,我建议您将数据分成不同的系列,然后使用 linkedTo 选项。例如:

In general, each of series required sorted data by x-values. In your case it won't be sorted. So I would suggest to separate your data into different series and then connect series using linkedTo option. for example:

$('#container').highcharts({
    series: [{
        id: 'main',
        data: [{
            x: 5,
            y: 10
        }, {
            x: 7,
            y: 10
        }]
    }, {
        data: [{
            x: 2,
            y: 12
        }, {
            x: 9,
            y: 12
        }],
        linkedTo: 'main'
    }]
});

和现场演示: http://jsfiddle.net/24qf98xL/1/

这篇关于HighCharts:在单个系列中绘制多个细分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆