Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有双Y轴的实现案例或者方式吗? #234

Closed
gejialun8888 opened this issue Mar 29, 2018 · 3 comments
Closed

有双Y轴的实现案例或者方式吗? #234

gejialun8888 opened this issue Mar 29, 2018 · 3 comments

Comments

@gejialun8888
Copy link

gejialun8888 commented Mar 29, 2018

比如X轴显示时间,左边Y轴是数量,右边Y轴是百分比,显示多条折线的方式展示

@gejialun8888
Copy link
Author

gejialun8888 commented Mar 30, 2018

image
要是现实这样的方式呢!感谢
现在目前实现成这样
image
右边Y轴怎么对应啊
对应代码

const ds = new DataSet();
        const dv = ds.createView().source(props.content);
        dv.transform({
            type: 'fold',
            fields: props.checkedValue, // 展开字段集
            key: 'name', // key字段
            value: 'temperature', // value字段
            retains: ['statis_date']        // 保留字段集,默认为除 fields 以外的所有字段
        });
        return (
            <div>
            <Chart height={400} data={dv} forceFit padding={[ 20, 60, 60, 60]}>
                <Axis name="statis_date" />
                <Axis name="temperature"  />
                <Tooltip crosshairs={{type : "y"}}/>
                <Geom type="line" position="statis_date*temperature" size={2} color={'name'} shape={'smooth'} />
                <Geom type='point' position="statis_date*temperature" size={4} shape={'circle'} color={'name'} style={{ stroke: '#fff', lineWidth: 1}} />
            </Chart>
            </div>
        )

求方式

@BambooSword
Copy link
Contributor

你的数据结构是怎样的,上面同学不是已经给你例子了吗? 不过我从你目前的代码分析:statis_date 是 时间对应 x 轴,temperature是温度,对应 Y轴左边,你没有数据对应Y轴右边,所以Y轴右边没有数据很正常(如果数据结构没猜错的话)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants