Module: ApexCharts::Charts::Features::Annotations
- Includes:
- Utils::Hash
- Included in:
- CartesianChart, MixedCharts
- Defined in:
- lib/apex_charts/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
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/apex_charts/charts/features/annotations.rb', line 5 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
30 31 32 |
# File 'lib/apex_charts/charts/features/annotations.rb', line 30 def point_annotation(**args) annotation :points, **args end |
#x_annotation(**args) ⇒ Object
22 23 24 |
# File 'lib/apex_charts/charts/features/annotations.rb', line 22 def x_annotation(**args) annotation :xaxis, **args end |
#y_annotation(**args) ⇒ Object
26 27 28 |
# File 'lib/apex_charts/charts/features/annotations.rb', line 26 def y_annotation(**args) annotation :yaxis, **args end |