@@ -5,14 +5,14 @@ defmodule Matplotex.Figure.Areal do
55 @ callback create ( struct ( ) , any ( ) , keyword ( ) ) :: struct ( )
66 @ callback materialize ( struct ( ) ) :: struct ( )
77 @ callback plotify ( number ( ) , tuple ( ) , number ( ) , number ( ) , list ( ) , atom ( ) ) :: number ( )
8+ @ callback with_legend_handle ( struct ( ) , struct ( ) ) :: struct ( )
89 defmacro __using__ ( _ ) do
910 quote do
1011 @ behaviour Matplotex.Figure.Areal
1112 alias Matplotex.Figure.TwoD
1213 alias Matplotex.Figure.Dimension
1314 alias Matplotex.Figure.Coords
1415 alias Matplotex.Figure.Text
15- alias Matplotex.Figure.Legend
1616
1717 import Matplotex.Figure.Areal , only: [ transformation: 7 , do_transform: 6 ]
1818 import Matplotex.Blueprint.Frame
@@ -154,6 +154,7 @@ defmodule Matplotex.Figure.Areal do
154154 |> Cast . cast_spines_by_region ( )
155155 |> Cast . cast_label_by_region ( )
156156 |> Cast . cast_title_by_region ( )
157+ |> Cast . cast_legends ( )
157158 end
158159
159160 defp update_tick ( axes , tick ) do
@@ -255,7 +256,6 @@ defmodule Matplotex.Figure.Areal do
255256
256257 def set_region_title ( figure ) , do: figure
257258
258-
259259 def set_region_legend (
260260 % Figure {
261261 axes:
@@ -274,7 +274,7 @@ defmodule Matplotex.Figure.Areal do
274274 region_x_width_after_legend = region_x_width - region_legend_width
275275
276276 { x_region_legend , y_region_legend } =
277- Algebra . transform_given_point ( - region_legend_width , - region_title_height , rx , ty , 0 )
277+ Algebra . transform_given_point ( - region_legend_width , - region_title_height , rx , ty )
278278
279279 % Figure {
280280 figure
@@ -294,17 +294,19 @@ defmodule Matplotex.Figure.Areal do
294294 }
295295 }
296296 end
297+
297298 def set_region_legend ( figure ) , do: figure
299+
298300 def set_region_content (
299- % Figure {
300- axes:
301- % {
302- region_x: % Region { x: x_region_x , width: region_x_width } ,
303- region_y: % Region { y: y_region_y , height: region_y_height } ,
304- region_content: region_content
305- } = axes
306- } = figure
307- ) do
301+ % Figure {
302+ axes:
303+ % {
304+ region_x: % Region { x: x_region_x , width: region_x_width } ,
305+ region_y: % Region { y: y_region_y , height: region_y_height } ,
306+ region_content: region_content
307+ } = axes
308+ } = figure
309+ ) do
308310 % Figure {
309311 figure
310312 | axes: % {
@@ -319,6 +321,7 @@ defmodule Matplotex.Figure.Areal do
319321 }
320322 }
321323 end
324+
322325 def set_region_content ( figure ) , do: figure
323326 end
324327 end
0 commit comments