birt 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 928c19e29b5822e9f31cb341f7d9e8fb1253d640
4
- data.tar.gz: 67df5e8d09dca61f5228ea3875be177969d34060
3
+ metadata.gz: 49ffc32249260e8dc1446bd5a0810a334540cd14
4
+ data.tar.gz: d45a3870ce134548c63b0499d5bdc8cd6be63d7a
5
5
  SHA512:
6
- metadata.gz: 2df786a2ab27f01ee7ad2652c597b8adcf79f603d4a1c0684b198c0f006dbfe74a4ea28676b7a4af3115de091a4d48affc03804f4973d4edad6a2cdb8d55a7fb
7
- data.tar.gz: d8c95e8f7cc2eb6120b3237c458f6bbb4b2476dbfa394a0062442c327149e8b6a43eced6745743e8198bd62afc442cc3ca2a23a89ae82d98f4fb58732da93e5f
6
+ metadata.gz: 0c6a97f3c6b71bdae08154b8a92784814e4c66d966f1ef1c87afb7275a5710bd88b3a7c4e0b49b7ddb1ca03abda5e9846f2225bed4215b23c19770b21649b2d4
7
+ data.tar.gz: 495e0ff386d49102a3ff847f10dba06749b2cd811515e0f61e4f9289e681c5fe7d74e16e4db1c6cf508c34f6df8195682f3bdc953e10d8e4607a4dd3fe3263fe
@@ -0,0 +1,6 @@
1
+ module ApplicationHelper
2
+
3
+ def birt(rptdesign_name=nil)
4
+ "<div class=\"birt\" data-rptdesign=\"#{rptdesign_name||params[:_report]}.rptdesign\"></div>".html_safe
5
+ end
6
+ end
@@ -1,3 +1 @@
1
- <div class="birt">
2
-
3
- </div>
1
+ <%= birt %>
@@ -5,4 +5,4 @@
5
5
 
6
6
  var birt = new Birt();
7
7
 
8
- birt.getRetDesign('003.rptdesign');
8
+ birt.getRetDesign();
@@ -19,7 +19,7 @@ var Birt = (function () {
19
19
  $.birtLoading();
20
20
  $.ajax(
21
21
  {
22
- url: '/birt/api.json?_report={0}'.format(rptDesignName),
22
+ url: '/birt/api.json?_report={0}'.format(rptDesignName||$birt.data('rptdesign')),
23
23
  type: 'GET',
24
24
  success: function (data) {
25
25
  $.birtLoading('hide');
@@ -22,11 +22,10 @@ class Birt::Core::LineChartReport < Birt::Core::BaseReport
22
22
  @horizontal_row = elem_text(xml_e, "/model:ChartWithAxes/Axes/SeriesDefinitions/Series/DataDefinition/Definition").gsub("row[\"", '').gsub("\"]", '')
23
23
 
24
24
 
25
- xml_e.get_elements("/model:ChartWithAxes/Axes/AssociatedAxes/SeriesDefinitions/Series[@xsi:type='type:LineSeries']/DataDefinition/Definition").each do |item|
26
- @series_rows << item.text.gsub("row[\"", '').gsub("\"]", '')
25
+ xml_e.get_elements("/model:ChartWithAxes/Axes/AssociatedAxes/SeriesDefinitions/Series[@xsi:type='type:LineSeries']").each do |item|
26
+ @series_rows << Birt::Core::SeriesRow.new(item)
27
27
  end
28
28
 
29
- # @series_rows << elem_text(xml_e, "/model:ChartWithAxes/Axes/AssociatedAxes/SeriesDefinitions/Series[@xsi:type='type:LineSeries']/DataDefinition/Definition").gsub("row[\"", '').gsub("\"]", '')
30
29
  end
31
30
 
32
31
  yield(self) if block_given?
@@ -51,10 +50,10 @@ class Birt::Core::LineChartReport < Birt::Core::BaseReport
51
50
 
52
51
  @json[:x_data] = data_set_result.columns[data_set_result.column_headers.index(@horizontal_row)]
53
52
  @json[:series] = []
54
- @series_rows.each { |series_name|
53
+ @series_rows.each { |series_row|
55
54
  @json[:series] << {
56
- name: series_name,
57
- data: _series_data.call(data_set_result, series_name)
55
+ name: series_row.display_name,
56
+ data: _series_data.call(data_set_result, series_row.column_name)
58
57
  }
59
58
  }
60
59
  @json
@@ -0,0 +1,13 @@
1
+ class Birt::Core::SeriesRow< Birt::Core::BaseReport
2
+
3
+ attr_accessor :column_name
4
+ attr_accessor :display_name
5
+
6
+ def initialize(xml_e)
7
+ super(xml_e) do
8
+ @column_name = elem_text(xml_e,"DataDefinition/Definition").gsub("row[\"", '').gsub("\"]", '')
9
+ @display_name = elem_text(xml_e,"SeriesIdentifier")
10
+ end
11
+ yield(self) if block_given?
12
+ end
13
+ end
data/lib/birt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Birt
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  module Core
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: birt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer
@@ -116,6 +116,7 @@ files:
116
116
  - app/controllers/application_controller.rb
117
117
  - app/controllers/birt/api_controller.rb
118
118
  - app/controllers/birt_test_controller.rb
119
+ - app/helpers/application_helper.rb
119
120
  - app/helpers/birt/api_helper.rb
120
121
  - app/views/birt/api/index.json.jbuilder
121
122
  - app/views/birt_test/index.html.erb
@@ -143,6 +144,7 @@ files:
143
144
  - lib/birt/core.rb
144
145
  - lib/birt/core/base_report.rb
145
146
  - lib/birt/core/chart/line_chart_report.rb
147
+ - lib/birt/core/chart/series_row.rb
146
148
  - lib/birt/core/data_set.rb
147
149
  - lib/birt/core/data_set_result.rb
148
150
  - lib/birt/core/data_source.rb