GithubHelp home page GithubHelp logo

ios-echarts's Introduction

iOS- Echarts - A control build with echarts

中文文档

Build Status CocoaPods Compatible


This is a highly custom chart control for iOS and Mac apps, which build with the Echart(Echart2). It just encapsulate the conrol of the javascript. It provides a chainable way of describing your configurations for the echarts. It's convinient for foucing on the logic of the app and optimizing the code. It avoid diverting developers' mind on the interaction between javascript and Objective-C.

Tips: If you want to use even iOS8.0, I suggest you use WKEchartsView which is based on WKWebView. The interface of WKEchartsView is same as PYEchartsView, so if you are using PYEchartsView, you just change PYEchartsView into WKEchartsView.

If you like this control, please star it. It can make me pay more attention on it.

And also if you find a issue, please issue me. Pull requests are warmly welcome as well.

screen-shot screen-shot

Echarts Informations


Echarts Github

Echarts WebSite(English)

Installation


There are two ways to use iOS-Echarts in you project:

  • Using cocoapods:pod iOS-Echarts
  • Manually:
    • First, copying all the files into you project
    • Second, Remove referencesthe directory named 'js'
    • Finnaly, add the directory named 'js' and 'theme' by create floder references

⚠️ *** Please Be Sure The Color Of js and theme Directory Is Blue. *** ⚠️

You should import one header file in your project:iOS-Echarts.h when you will use it. Finally you just need to initialze the PYEchartsView and PYOption you need.

If you don't know how to set the right value for the option, you can check the documents in the EChart Website.

Usage


The common step like the under codes:

// Firstly, you should have a instance of PYEchartsView
@property (weak, nonatomic) IBOutlet PYEchartsView *echartsView;

...

PYOption *option = ... // Then, configure something about options
// Finally, load echarts view
[_echartsView setOption:option]; 
[_echartsView loadEcharts];

All properties setter are chainable, you can use [property-name]Equal

PYOption *option = [PYOption initPYOptionWithBlock:^(PYOption *option) {

    option.titleEqual([PYTitle initPYTitleWithBlock:^(PYTitle *title) {
        title.textEqual(@"Event River").subtextEqual(@"Test subtext");
    }])
    .tooltipEqual([PYTooltip initPYTooltipWithBlock:^(PYTooltip *tooltip) {
        tooltip.triggerEqual(PYTooltipTriggerItem).enterableEqual(YES);
    }])
    .legendEqual([PYLegend initPYLegendWithBlock:^(PYLegend *legend) {
        legend.dataEqual(@[@"first data", @"second data"]);
    }])
    .toolboxEqual([PYToolbox initPYToolboxWithBlock:^(PYToolbox *toolbox) {
        toolbox.showEqual(YES).featureEqual([PYToolboxFeature initPYToolboxFeatureWithBlock:^(PYToolboxFeature *feature) {
            feature.markEqual([PYToolboxFeatureMark initPYToolboxFeatureMarkWithBlock:^(PYToolboxFeatureMark *mark) {
                mark.showEqual(YES);
            }])
            .restoreEqual([PYToolboxFeatureRestore initPYToolboxFeatureRestoreWithBlock:^(PYToolboxFeatureRestore *restore) {
                restore.showEqual(YES);
            }]);
        }]);
    }])
    .xAxisEqual([[NSMutableArray alloc] initWithArray:@[axis]])
    .seriesEqual([[NSMutableArray alloc] initWithArray:@[series1, series2]])
    .gridEqual([PYGrid initPYGridWithBlock:^(PYGrid *grid) {
        grid.xEqual(@10)
        .x2Equal(@30);
    }]);
}];

Many properties support add[Name] and add[Name]Arr methods, when you use properties which type is NSMutableArray, you should try add method first

option.addXAxis(//Something about PYAxis)
.addYAxis(//Something about PYAxis)
.addSeries(//Something about PYSeries or sub class of PYSeries)

When you use the instance which is subclass of PYSeries, you should assign value for the property of subclass, then assign value for PYSeries, like this:

.addSeries([PYCartesianSeries initPYCartesianSeriesWithBlock:^(PYCartesianSeries *series) {
    series.stackEqual(@"Total")
    .smoothEqual(YES)
    .symbolEqual(PYSymbolArrow)
    .symbolSizeEqual(@6)
    .symbolRotateEqual(@(-45))
    .nameEqual(@"Data1")
    .typeEqual(PYSeriesTypeLine)
    .itemStyleEqual([PYItemStyle initPYItemStyleWithBlock:^(PYItemStyle *itemStyle) {
        itemStyle.normalEqual([PYItemStyleProp initPYItemStylePropWithBlock:^(PYItemStyleProp *normal) {
            normal.colorEqual(PYRGBA(255, 0, 0, 1))
            .lineStyleEqual([PYLineStyle initPYLineStyleWithBlock:^(PYLineStyle *lineStyle) {
                lineStyle.widthEqual(@2).typeEqual(PYLineStyleTypeDashed);
            }]);
        }]).emphasisEqual([PYItemStyleProp initPYItemStylePropWithBlock:^(PYItemStyleProp *emphasis) {
            emphasis.colorEqual(PYRGBA(0, 0, 255, 1));
        }]);
    }])
    .dataEqual(@[@(320), @(332), @"-", @(334), @{@"value":@(390),@"symbol":@"star6",@"symbolSize":@(20),@"symbolRotate":@(10),@"itemStyle":@{@"normal":@{@"color":@"yellowgreen"},@"emphasis":@{@"color":@"orange",@"lable":@{@"show":@(YES),@"position":@"inside",@"textStyle":@{@"fontSize":@(20)}}}}}, @(330), @(320)]);
}])

The PYCartesianSeries is subclass of PYSeries, and stack, smooth, symbol, symbolSize and symbol are the properties of PYCartesianSeries. So you should assign them before the properies of PYSeries.

You also can assign all values one by one:

PYEventRiverSeries *series1 = [PYEventRiverSeries initPYEventRiverSeriesWithBlock:^(PYEventRiverSeries *series) {
    series.weight = @123;
    series.name = @"Series name";
    series.type = PYSeriesTypeEventRiver;
}];

All propertis can use init[Type]WithBlock for creation:

PYAxis *axis = [PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
    axis.typeEqual(PYAxisTypeTime).boundaryGapEqual(@[@0.05, @0.1]);
}];

Contact


Follow and contact me on Twitter or Sina Weibo. And if you want to contribute with this projust, please contact me as well.

If you have QQ, you can join the group which number is 485591970.

Licenses


All source code is licensed under the MIT License.

ios-echarts's People

Contributors

pluto-y avatar wjiuxing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios-echarts's Issues

Echarts交互事件

我想实现的功能是点击面积图任意一点,跟他数据相关的控制器刷新数据!这个怎么实现呀 方便留一个联系方式吗

编译失败 PYPropertyEqualTemplate

/Users/xfjc/Desktop/WisdomClass/WisdomHomeWork/HomeWork/Resources/Libs/iOS-Echarts/Model/PYLoadingOption.h:38:40: Interface type 'PYLoadingOption' cannot be passed by value; did you forget * in 'PYLoadingOption'?

请问这个是什么问题?

chart的使用

你好 我在使用echart的时候 生成json怎么快速处理呢

求助

你好,我按照你的方法,用cocoapod接入了,但是会有很多报错呢,不需要别的步骤吗

图标经常加载不出来

下载项目默认什么都不动直接运行,图表是可以加载出来的,但是我在echarts-all.js文件添加了个alert弹框后,弹框和图表都不出来了,后来我删了alert的代码再运行项目图表还是不出来,后来我新建了个项目把把iOS-Echarts文件夹拉到新项目中,并删除了JS文件夹的引用,添加了create floder references引用,然后在故事板拉了个webview并将属性custom class修改为了PYChartsView,然后调用了Demo中K线图的 showCandlestickDemo1,loadEcharts方法结果图表也出来,是否我的布置缺少什么步骤?

折线图,断开的点如何传值

在折线图中,要表示无值的点,要传递什么?

我在做一个实时更新的折线图,数据是不断的添加的。在添加过程中会遇到某些点数据是无,但是仍然要在图中有所表示。

比如data:[11, 11, 15, , 30, 13, 10], 15和30之间少了一个值,最后图像在15和30间空出一个位置,并不做连线。

在iOS中,要传递什么值?我试了下[NSNull null],会导致bug,后面的数据全部变成不连线了。

如何设置图例不可点击

折线图只有一组数据 点击之后 数据和y轴值都没了 怎么设置不可以点击或者说点击不消失

怎么添加第2个Y轴

如题,线性折线图里支持添加多个折线,请问怎么添加第2个Y轴的显示

关于坐标文本间距 PYInterval 的问题。

使用 PYIntervalAll 结果x轴坐标只显示第一个项目的文本,
我试着把 PYIntervalAll = @"all";
改成 PYIntervalAll = @"0";
就可以显示全部项目了,是否是我哪里弄错了?

Getting more done in GitHub with ZenHub

Hola! @F2EVarMan has created a ZenHub account for the Pluto-Y organization. ZenHub is the only project management tool integrated natively in GitHub – created specifically for fast-moving, software-driven teams.


How do I use ZenHub?

To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

What can ZenHub do?

ZenHub adds a series of enhancements directly inside the GitHub UI:

  • Real-time, customizable task boards for GitHub issues;
  • Multi-Repository burndown charts, estimates, and velocity tracking based on GitHub Milestones;
  • Personal to-do lists and task prioritization;
  • Time-saving shortcuts – like a quick repo switcher, a “Move issue” button, and much more.

Add ZenHub to GitHub

Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @F2EVarMan.

ZenHub Board

bug

你好,谢谢你的分享,说个事,我点击图形时,出形的提示会弹跳两下,希望能改一下,对了,随道 问一下,你那是否还需要人力,如果要的话,我可以贡献我的热诚

Echart

折线图,我如何获取我点击时的X的位置

添加数据问题

series.data = @"(function () {var d = [];var len = 0;var now = new Date();var value;while (len++ < 150) {d.push([new Date(2014, 9, 1, 0, len*100),(Math.random()*30).toFixed(2) - 0,(Math.random()*100).toFixed(2) - 0]);}return d;})()";

这是不等距折线图的加载数据,这是demo给的方法,可是我做的是ios项目,我获得是(时间,数值)的数组,如何能把这个数据添加到图标中啊?这series.data 后面跟的js啊,我的数据是对象数组啊?怎么转换带入啊,不会啊,求解啊?最好能写个小demo给我看看,谢谢!

使用iOS-Echarts问题

今天使用iOS-echarts中的标准饼状图的时候,遇到一个问题
57b9f061-e32e-437f-92cf-bbbe0cf6cc41没有显示饼状图的图表

非常好用

非常好用,希望继续维护和升级!!加油

[PYEchartsView refreshEcharts] 不起作用

我需要更新数据。于是我获取option,并添加数据。我选择的是折线图。
option.series[0].addData(@"20");
option.xAxis[0].addData(@"周一");//同时我也新增了x轴
最后我调用
[chartsView refreshEcharts];
什么都没改变。
但是如果我调用
[chartsView loadEcharts];
可以看到改变的效果。
但是这会刷新所有的数据。像这个https://segmentfault.com/q/1010000005054630 的问题一样。
请问刷新数据的正确姿势。

ps:js文件似乎很久没有更新了,是否需要更新?我在echarts官网上,发现不需要更新x轴,也可以达到添加数据的效果。(demo中,如果只添加数据,不添加x轴,则也不会更新)

报错

1、我使用pods下载下来之后 ,里面没iOS-Echarts.h这个文件,#import "iOS-Echarts.h"之后找不到头文件;2、直接下载demo拷贝demo里面的iOS-charts这个文件(已经把js路径里的文件变成蓝色文件夹了),编译报错,错是PYColor交叉引用,但是并没有改动里面的东西。
以上问题期待优化,谢谢。

如何使最小值和最大值的横线不受splitline的linestyle影响

2016-09-17 12 53 45

横的虚线我是通过axis->splitLine->lineStyle设置的,但是这样设置之后,最小的-250和最大的750那两根线也受到影响了(实线和虚线都重合了),可不可以最小的和最大的那两根线还是实线? 下面是我关于这一部分的代码: .addYAxis([PYAxis initPYAxisWithBlock:^(PYAxis *axis) { axis .typeEqual(PYAxisTypeValue) .axisLabelEqual([PYAxisLabel initPYAxisLabelWithBlock:^(PYAxisLabel *axisLabel) { axisLabel .formatterEqual(@"{value}%") .marginEqual(@8) .textStyleEqual([PYTextStyle initPYTextStyleWithBlock:^(PYTextStyle *textStyle) { textStyle .colorEqual(PYRGBA(51, 51, 51, 1)) .fontSizeEqual(@10); }]); }]) .splitLineEqual([PYAxisSplitLine initPYAxisSplitLineWithBlock:^(PYAxisSplitLine *spliteLine) { spliteLine.lineStyleEqual([PYLineStyle initPYLineStyleWithBlock:^(PYLineStyle *lineStyle) { lineStyle.typeEqual(PYLineStyleTypeDashed); }]); }]) .axisLineEqual([PYAxisLine initPYAxisLineWithBlock:^(PYAxisLine *axisLine) { axisLine.lineStyleEqual([PYLineStyle initPYLineStyleWithBlock:^(PYLineStyle *lineStyle) { lineStyle.typeEqual(PYLineStyleTypeSolid); }]) .onZeroEqual(NO) .showEqual(NO) ; }]) .minEqual(@-250) .maxEqual(@750) .splitNumberEqual(@4) ; }])

导入iOS-ECharts后,import “PYEchartsView.h”调试保错

1./Users/goodbaby/Documents/xcode_workspace/GBSmartManufacture_TC/Pods/Headers/Public/iOS-Echarts/PYEchartsView.h:73:40: No type or protocol named 'PY_WEB_DELEGATE'

2./Users/goodbaby/Documents/xcode_workspace/GBSmartManufacture_TC/Pods/Headers/Public/iOS-Echarts/PYEchartsView.h:73:28: Cannot find interface declaration for 'PY_WEB_VIEW', superclass of 'PYEchartsView'

3./Users/goodbaby/Documents/xcode_workspace/GBSmartManufacture_TC/Pods/Headers/Public/iOS-Echarts/PYEchartsView.h:77:31: Unknown type name 'PY_EDGE_INSET'

4./Users/goodbaby/Documents/xcode_workspace/GBSmartManufacture_TC/Pods/Headers/Public/iOS-Echarts/PYEchartsView.h:154:84: Unknown type name 'PY_IMAGE'

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.