report_html 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -509,9 +509,7 @@ class Report_html
509
509
  def add_canvas_attr(hash_attr, attr2add)
510
510
  attr2add.each do |attrs|
511
511
  attr_name = attrs.shift
512
- canvas_attr = []
513
- attrs.each{|at| canvas_attr << "#{attr_name} : #{at}" }
514
- hash_attr[attr_name] = canvas_attr
512
+ hash_attr[attr_name] = attrs
515
513
  end
516
514
  end
517
515
 
@@ -578,14 +576,58 @@ class Report_html
578
576
  }.merge!(user_options)
579
577
  html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
580
578
  config['graphType'] = 'Boxplot'
581
- options[:mod_data_structure] = 'boxplot'
582
- if options[:extracode].nil?
579
+ if default_options[:group].nil?
580
+ options[:mod_data_structure] = 'boxplot'
581
+ else
582
+ if default_options[:group].class == String
583
+ reshape(samples, vars, x, values)
584
+ group = default_options[:group]
585
+ series = 'factor'
586
+ else
587
+ series, group = default_options[:group]
588
+ end
589
+ if config["groupingFactors"].nil? # if config is defined, we assume that the user set this property to the value that he/she desires
590
+ if group.nil?
591
+ config["groupingFactors"] = [series]
592
+ else
593
+ config["groupingFactors"] = [series, group]
594
+ end
595
+ end
596
+ config["colorBy"] = series if config["colorBy"].nil?
597
+ config["segregateSamplesBy"] = [group] if !group.nil? && config["segregateSamplesBy"].nil?
598
+ end
599
+ if options[:extracode].nil? && default_options[:group].nil?
583
600
  options[:extracode] = "C#{object_id}.groupSamples([\"Factor\"]);"
584
601
  end
585
602
  end
586
603
  return html_string
587
604
  end
588
605
 
606
+ def reshape(samples, vars, x, values)
607
+ item_names = samples.dup
608
+ (vars.length - 1).times do |n|
609
+ samples.concat(item_names.map{|i| i+"_#{n}"})
610
+ end
611
+ x.each do |factor, annotations|
612
+ current_annotations = annotations.dup
613
+ (vars.length - 1).times do
614
+ annotations.concat(current_annotations)
615
+ end
616
+ end
617
+ series_annot = []
618
+ vars.each do |var|
619
+ item_names.each do
620
+ series_annot << var
621
+ end
622
+ end
623
+ x['factor'] = series_annot
624
+ vars.select!{|v| v.nil?}
625
+ vars << 'vals'
626
+ vals = values.flatten
627
+ values.select!{|v| v.nil?}
628
+ values << vals
629
+ end
630
+
589
631
  def pie(user_options = {}, &block)
590
632
  default_options = {
591
633
  transpose: false
@@ -1,3 +1,3 @@
1
1
  module ReportHtml
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
data/report_html.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["seoanezonjic@hotmail.com"]
11
11
 
12
12
  spec.summary = %q{Gem to build html interactive reports.}
13
- spec.description = %q{Html reports based on erb, HTML5 and javascript libraries.}
13
+ spec.description = %q{iDEPRECATED PROJECT. MIGRATED TO PYTHON: https://github.com/seoanezonjic/py_report_html\n.Html reports based on erb, HTML5 and javascript libraries.}
14
14
  spec.homepage = ""
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: report_html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - seoanezonjic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-10 00:00:00.000000000 Z
11
+ date: 2025-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,7 +38,8 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: Html reports based on erb, HTML5 and javascript libraries.
41
+ description: 'iDEPRECATED PROJECT. MIGRATED TO PYTHON: https://github.com/seoanezonjic/py_report_html\n.Html
42
+ reports based on erb, HTML5 and javascript libraries.'
42
43
  email:
43
44
  - seoanezonjic@hotmail.com
44
45
  executables:
@@ -87,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  - !ruby/object:Gem::Version
88
89
  version: '0'
89
90
  requirements: []
90
- rubygems_version: 3.2.15
91
+ rubygems_version: 3.3.7
91
92
  signing_key:
92
93
  specification_version: 4
93
94
  summary: Gem to build html interactive reports.