GithubHelp home page GithubHelp logo

怎么添加第2个Y轴 about ios-echarts HOT 10 CLOSED

pluto-y avatar pluto-y commented on May 29, 2024
怎么添加第2个Y轴

from ios-echarts.

Comments (10)

Pluto-Y avatar Pluto-Y commented on May 29, 2024

可以参考官方的json的Demo:http://echarts.baidu.com/echarts2/doc/example/line6.html

from ios-echarts.

aslanTT avatar aslanTT commented on May 29, 2024

这个json我看过,Y轴里是个数组,但是iOS-Echarts里怎么添加可以实现啊?

from ios-echarts.

Pluto-Y avatar Pluto-Y commented on May 29, 2024

可以通过 PYOption 的的 addYAxis 方法,或者直接用 yAxisEqual(数组) 这两种方式都可以啊

from ios-echarts.

aslanTT avatar aslanTT commented on May 29, 2024

screen shot 2017-03-10 at 9 45 39 am
PYOption里addYAxis试过了,不管用。我看看你说的yAxisEqual可不可以

from ios-echarts.

aslanTT avatar aslanTT commented on May 29, 2024

simulator screen shot 10 mar 2017 10 01 48 am
screen shot 2017-03-10 at 10 02 15 am

yAxisEqual这个也不行

from ios-echarts.

Pluto-Y avatar Pluto-Y commented on May 29, 2024

我试了一下是可以的,不知道你为什么不行~

//  忽略前面~
.addXAxis([PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
            axis.typeEqual(PYAxisTypeCategory)
            .boundaryGapEqual(@NO)
            .addDataArr(@[@"周一",@"周二",@"周三",@"周四",@"周五",@"周六",@"周日"]);
        }])
        .addYAxis([PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
            axis.typeEqual(PYAxisTypeValue)
            .axisLabelEqual([PYAxisLabel initPYAxisLabelWithBlock:^(PYAxisLabel *axisLabel) {
                axisLabel.formatterEqual(@"{value} ℃");
            }]);
        }])
        .addYAxis([PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
            axis.typeEqual(PYAxisTypeValue).axisLabelEqual([PYAxisLabel initPYAxisLabelWithBlock:^(PYAxisLabel *axisLabel) {
                axisLabel.formatterEqual(@"{value} ℃");
            }]);
        }])
        .addSeries([PYSeries initPYSeriesWithBlock:^(PYSeries *series) {
            series.nameEqual(@"最高温度")
            .typeEqual(PYSeriesTypeLine)
            .dataEqual(@[@(11),@(11),@(15),@(13),@(12),@(13),@(10)])
            .markPointEqual([PYMarkPoint initPYMarkPointWithBlock:^(PYMarkPoint *point) {
                point.addDataArr(@[@{@"type" : @"max", @"name": @"最大值"},@{@"type" : @"min", @"name": @"最小值"}]);
            }])
            .markLineEqual([PYMarkLine initPYMarkLineWithBlock:^(PYMarkLine *markLine) {
                markLine.addDataArr(@[@{@"type" : @"average", @"name": @"平均值"}]);
            }]);
            
        }])
        .addSeries([PYCartesianSeries initPYCartesianSeriesWithBlock:^(PYCartesianSeries *series) {
            series.yAxisIndexEqual(@1).nameEqual(@"最低温度")
            .typeEqual(PYSeriesTypeLine)
            .dataEqual(@[[NSNull null],@(-2),[NSNull null],@(5),@(3),[NSNull null],@(0)])
            .markPointEqual([PYMarkPoint initPYMarkPointWithBlock:^(PYMarkPoint *point) {
                point.addDataArr(@[@{@"value" : @(2), @"name": @"周最低", @"xAxis":@(1), @"yAxis" : @(-1.5)}]);
            }])
            .markLineEqual([PYMarkLine initPYMarkLineWithBlock:^(PYMarkLine *markLine) {
                markLine.addDataArr(@[@{@"type" : @"average", @"name": @"平均值"}]);
            }]);
        }]);

image

from ios-echarts.

Pluto-Y avatar Pluto-Y commented on May 29, 2024

image

from ios-echarts.

aslanTT avatar aslanTT commented on May 29, 2024

我是在stackedLineOption里试的,这个不行么

from ios-echarts.

aslanTT avatar aslanTT commented on May 29, 2024

我知道问题了,series里我没有指定yAxisIndex导致的,再加上这个就没问题了,谢谢

from ios-echarts.

aslanTT avatar aslanTT commented on May 29, 2024

还有个问题。。
两边的Y轴可以共用一个网格线吗,像你的截图里,两边的Y轴点是一样的,但是各画各的网格线了

from ios-echarts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.