Module: ChartingUi::ViewHelpers

Defined in:
lib/charting_ui/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#create_charting_area_hardcoded_scatter(collection, title:, title_tag: ChartingUi.configuration.default_title_tag, title_class: "", x_dimension: nil, y_dimension: nil, axe_x_title:, axe_y_title:, offset_left: ChartingUi.configuration.default_offset_left, offset_right: ChartingUi.configuration.default_offset_right, offset_top: ChartingUi.configuration.default_offset_top, offset_bottom: ChartingUi.configuration.default_offset_bottom, font_family: ChartingUi.configuration.default_font_family, font_size: ChartingUi.configuration.default_font_size, bordered: true) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/charting_ui/view_helpers.rb', line 4

def create_charting_area_hardcoded_scatter(collection, title: ,
	title_tag: ChartingUi.configuration.default_title_tag,
	title_class: "",
	x_dimension: nil,
	y_dimension: nil,
	axe_x_title: ,
	axe_y_title:,
	offset_left: ChartingUi.configuration.default_offset_left,
	offset_right: ChartingUi.configuration.default_offset_right,
	offset_top: ChartingUi.configuration.default_offset_top,
	offset_bottom: ChartingUi.configuration.default_offset_bottom,
	font_family: ChartingUi.configuration.default_font_family,
	font_size: ChartingUi.configuration.default_font_size,
	bordered: true
	)

	render partial: 'charting_ui/chart_content', locals: {
		_charting: {
			bordered: bordered,
			title:
			{
				tag: title_tag,
				content: title,
				class: title_class
			},
			data: {
				type: "scatter",
				collection: collection,
				offsets: {
					left: offset_left,
					right: offset_right,
					top: offset_top,
					bottom: offset_bottom
				},
				font: {
					family: font_family,
					size: font_size
				},
				axes: {
					x: {
						title: axe_x_title
					},
					y:{
						title: axe_y_title
					}
				}
			}
		}
	}
end

#create_charting_model_histogram(model_class_name:, name_of_key:, title:, title_tag: ChartingUi.configuration.default_title_tag, title_class: "", offset_left: ChartingUi.configuration.default_offset_left, offset_right: ChartingUi.configuration.default_offset_right, offset_top: ChartingUi.configuration.default_offset_top, offset_bottom: ChartingUi.configuration.default_offset_bottom, font_family: ChartingUi.configuration.default_font_family, font_size: ChartingUi.configuration.default_font_size, axe_x_title: Array(name_of_key).map{|n| n.capitalize() }.join(", "), axe_y_title: t("charting_ui.Sum"), bordered: true) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/charting_ui/view_helpers.rb', line 56

def create_charting_model_histogram(
	model_class_name: ,
	name_of_key: ,
	title: ,
	title_tag: ChartingUi.configuration.default_title_tag,
	title_class: "",
	offset_left: ChartingUi.configuration.default_offset_left,
	offset_right: ChartingUi.configuration.default_offset_right,
	offset_top: ChartingUi.configuration.default_offset_top,
	offset_bottom: ChartingUi.configuration.default_offset_bottom,
	font_family: ChartingUi.configuration.default_font_family,
	font_size: ChartingUi.configuration.default_font_size,
	axe_x_title: Array(name_of_key).map{|n| n.capitalize() }.join(", "),
	axe_y_title: t("charting_ui.Sum"),
	bordered: true
	)

	render partial: 'charting_ui/chart_content', locals: {
		_charting: {
			bordered: bordered,
			title:
			{
				tag: title_tag,
				content: title,
				class: title_class
			},
			data: {
				type: "histogram_model",
				model: {
					name: model_class_name,
					key: Array(name_of_key)
				},
				offsets: {
					left: offset_left,
					right: offset_right,
					top: offset_top,
					bottom: offset_bottom
				},
				font: {
					family: font_family,
					size: font_size
				},
				axes: {
					x: {
						title: axe_x_title
					},
					y:{
						title: axe_y_title
					}
				}
			}
		}
	}
end