如何在vega.js的表达式语言中控制输入

时间:2016-06-03 07:33:49

标签: vega

我正在尝试使用过滤器转换数据集。如何在表达式语言中调试输入?

        var spec = {
            signals: [
                {
                    "name": "crosshair_vertical",
                    "init": null,
                    "streams": [
                        {
                            "type": "mousemove",
                            "expr": "clamp(eventX(), 0, eventGroup('root').width)",
                            "scale": {"name": "xscale", "invert": true}
                        },
                        {
                            "type": "mouseout",
                            "expr": "null",
                        }
                    ]
                }
            ],
            data: [
                {
                    "name": "highlight_crosshair",
                    "source": "summary",
                    "transform": [
                        {
                            "type": "filter",
                            "test": "crosshair_vertical != null && utc(crosshair_vertical) - 6000 <= utc(datum.timestamp) && utc(datum.timestamp) <= utc(crosshair_vertical) + 6000"
                        }
                    ]
                }
            ]
        }

在数据转换的“test”属性中,想要做这样的事情

"test": "console.log(crosshair_vertical, datum);crosshair_vertical != null && utc(crosshair_vertical) - 6000 <= utc(datum.timestamp) && utc(datum.timestamp) <= utc(crosshair_vertical) + 6000"

我该怎么做?

0 个答案:

没有答案