【问题标题】:Extjs 4.2 chart lined series multiple data for yfieldyfield的Extjs 4.2图表衬里系列多个数据
【发布时间】:2017-10-16 09:01:45
【问题描述】:

docs这种系列的“yfield定义”中说:

与y轴值对应的数据模型字段的名称。

在此之后,我正在尝试将两个数据模型字段添加到 line serie 的同一 yfield。

这是一个普通的例子:example1

但是在this example 中,如果我尝试将两个数据模型字段放在意式的同一个 yfield 中,则该行会消失,但在图例中我会看到两个数据名称。

代码有问题,还是我遗漏了什么?

编辑 1

可能我自己解释错了,Gilsha提出的解决方案和example1的代码是一样的。

我想要这样的东西:

sin 和 cos 数据在同一个系列中,而不是每个值的单独系列。

【问题讨论】:

    标签: extjs extjs4.2


    【解决方案1】:

    您必须向轴和多线系列添加多个字段标签以绘制每条线,如下所示。

    series: [{
            type: 'line', //Plots sin
            axis: 'left',
            xField: 'theta',
            yField: 'sin',
            smooth: true,
            style: {
                'stroke-width': 4
            },
            markerConfig: {
                radius: 4
            },
            highlight: {
                shadow: false,
                fill: '#000',
                radius: 5,
                'stroke-width': 2,
                stroke: '#fff'
            }
        }, {
            type: 'line', //Plots cos
            axis: 'left',
            xField: 'theta',
            yField: 'cos',
            smooth: true,
            style: {
                'stroke-width': 4
            },
            markerConfig: {
                radius: 4
            },
            highlight: {
                shadow: false,
                fill: '#000',
                radius: 5,
                'stroke-width': 2,
                stroke: '#fff'
            }
        },{
            type: 'line', //Plots sin
            axis: 'left',
            xField: 'theta',
            yField: 'tan',
            smooth: true,
            style: {
                'stroke-width': 4
            },
            markerConfig: {
                radius: 4
            },
            highlight: {
                shadow: false,
                fill: '#000',
                radius: 5,
                'stroke-width': 2,
                stroke: '#fff'
            }
        }]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-27
      相关资源
      最近更新 更多