Skip to content

Commit

Permalink
For updated echarts version to 3.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
echohn committed Oct 16, 2017
1 parent 902789b commit 29a130b
Show file tree
Hide file tree
Showing 11 changed files with 167,129 additions and 3,525 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
/spec/dummy/tmp/

*.gem
.ruby-version
42 changes: 25 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
The MIT License (MIT)
BSD 3-Clause License

Copyright (c) 2016 Echo
Copyright (c) 2017, Echo Han
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
92 changes: 50 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# echarts-rails

Wrappers of Echarts Javascript Chart Libary for Rails 3.1+
Wrappers of ECharts Javascript Chart Libary for Rails 3.1+

Check out how to use echarts at http://echarts.baidu.com
Check out how to use ECharts at http://echarts.baidu.com

* echarts-rails 0.1.0 -> echarts 3.1.3
* echarts-rails 0.1.4 -> echarts 3.2.3
* echarts-rails 0.1.5 -> echarts 3.3.0
* echarts-rails 0.1.6 -> echarts 3.3.2
* echarts-rails 0.1.7 -> echarts 3.7.1
* echarts-rails 0.1.0 -> ECharts 3.1.3
* echarts-rails 0.1.4 -> ECharts 3.2.3
* echarts-rails 0.1.5 -> ECharts 3.3.0
* echarts-rails 0.1.6 -> ECharts 3.3.2
* echarts-rails 0.1.7 -> ECharts 3.7.1
* echarts-rails 0.1.8 -> ECharts 3.7.2

## Installation

Expand All @@ -20,12 +21,15 @@ gem 'echarts-rails'

And then execute:

$ bundle
```
$ bundle
```

Or install it yourself as:

$ gem install echarts-rails

```
$ gem install echarts-rails
```

Now you need to edit your `app/assets/javascripts/application.js` file and add `echarts` , `echarts-simple` or `echarts-common` into it:

Expand All @@ -35,51 +39,55 @@ Now you need to edit your `app/assets/javascripts/application.js` file and add `

The difference between `echarts` , `echarts.simple` or `echarts.common` :

* `echarts-en`: Includes all charts and components.
* `echarts.simple-en`: Only includes basic charts: line bar pie.
* `echarts.common-en`: Includes common charts and components: line bar pie scatter legend tooltip toolbox markLine markPoint markArea dataZoom

* `echarts`: 包含所有图表组件。
* `echarts.simple`: 只包含基础图表: 折 柱 饼。
* `echarts.common`: 包含常用的图表组件:折 柱 饼 散点 图例 工具栏 标注 标线 数据区域缩放

And you're done!




## Usage

```
<div id="main" style="width: 600px; height: 400px;"></div>
<script>
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
<!-- prepare a DOM container with width and height -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
// based on prepared DOM, initialize echarts instance
var myChart = echarts.init(document.getElementById('main'));
// specify chart configuration item and data
var option = {
title: {
text: 'ECharts entry example'
},
tooltip: {},
legend: {
data:['Sales']
},
xAxis: {
data: ["shirt","cardign","chiffon shirt","pants","heels","socks"]
},
yAxis: {},
series: [{
name: 'Sales',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
};
// use configuration item and data specified to show chart
myChart.setOption(option);
</script>
```


You can also go to [ECharts Gallery](https://ecomfe.github.io/echarts-examples/public/editor.html?c=doc-example/getting-started) to view examples.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
The gem is available as open source under the BSD license.

[ECharts](https://github.com/ecomfe/echarts/blob/master/LICENSE) is available under the BSD license.

12 changes: 6 additions & 6 deletions echarts-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |spec|
spec.name = "echarts-rails"
spec.version = "0.1.7"
spec.version = "0.1.8"
spec.authors = ["Echo Han"]
spec.email = ["[email protected]"]

spec.summary = "Wrappers of Echarts Javascript Chart Libary for Rails 3.1+"
spec.summary = "Wrappers of ECharts Javascript Chart Libary for Rails 3.1+"
spec.description = spec.summary
spec.homepage = "https://github.com/echohn/echarts-rails"
spec.license = "MIT"
spec.license = "BSD-3-Clause"

# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
# delete this section to allow pushing this gem to any host.
Expand All @@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.10"
spec.add_development_dependency "rails",">=3.1"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "bundler", ">= 1.10"
spec.add_development_dependency "rails",">= 3.1"
spec.add_development_dependency "rake", ">= 10.0"
spec.add_development_dependency "rspec"
end
4 changes: 2 additions & 2 deletions spec/requests/homepage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
expect(has_selector?(:xpath,'//body/div[@id="main"]/div/canvas')).to be true
end

scenario "Echarts version is 3.7.1", :js => true do
scenario "Echarts version is 3.7.2", :js => true do
visit root_path
expect(page.driver.console_messages.first[:message]).to eq('3.7.1')
expect(page.driver.console_messages.first[:message]).to eq('3.7.2')
end
end

Loading

0 comments on commit 29a130b

Please sign in to comment.