Module: ApexCharts::Annotations
- Includes:
- Utils::Hash
- Included in:
- CartesianChart, MixedCharts
- Defined in:
- lib/apexcharts/charts/features/annotations.rb
Instance Method Summary collapse
- #annotation(axis, value:, text:, color: nil, **options) ⇒ Object
- #point_annotation(**args) ⇒ Object
- #x_annotation(**args) ⇒ Object
- #y_annotation(**args) ⇒ Object
Methods included from Utils::Hash
camelize, camelize_keys, deep_merge
Instance Method Details
#annotation(axis, value:, text:, color: nil, **options) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/apexcharts/charts/features/annotations.rb', line 3 def annotation(axis, value:, text:, color: nil, **) @annotations ||= {} raise "unrecognized axis: #{axis}" unless %i[xaxis yaxis points].include? axis @annotations[axis] ||= [] @annotations[axis] << annotation_value(axis, value).merge( if axis == :points {marker: {size: 8, fillColor: 'white', strokeColor: color, radius: 2}, **} else {borderColor: color, fillColor: color, opacity: 0.2} end ).merge( annotation_label(text, color, **) ) end |
#point_annotation(**args) ⇒ Object
28 29 30 |
# File 'lib/apexcharts/charts/features/annotations.rb', line 28 def point_annotation(**args) annotation :points, **args end |
#x_annotation(**args) ⇒ Object
20 21 22 |
# File 'lib/apexcharts/charts/features/annotations.rb', line 20 def x_annotation(**args) annotation :xaxis, **args end |
#y_annotation(**args) ⇒ Object
24 25 26 |
# File 'lib/apexcharts/charts/features/annotations.rb', line 24 def y_annotation(**args) annotation :yaxis, **args end |