Skip to content

Commit 2b40a36

Browse files
committed
start upgrading to Makie v0.24
1 parent cbd923f commit 2b40a36

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

ext/DynamicQuantitiesMakieExt.jl

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Makie as M
77

88
M.expand_dimensions(::M.PointBased, y::AbstractVector{<:UnionAbstractQuantity}) = (keys(y), y)
99
M.create_dim_conversion(::Type{<:UnionAbstractQuantity}) = DQConversion()
10-
M.MakieCore.should_dim_convert(::Type{<:UnionAbstractQuantity}) = true
10+
M.should_dim_convert(::Type{<:UnionAbstractQuantity}) = true
1111

1212
unit_string(quantity::UnionAbstractQuantity) = string(dimension(quantity))
1313

@@ -77,21 +77,18 @@ function M.get_ticks(conversion::DQConversion, ticks, scale, formatter, vmin, vm
7777
return tick_vals, labels
7878
end
7979

80-
function M.convert_dim_observable(conversion::DQConversion, value_obs::M.Observable, deregister)
81-
# TODO: replace with update_extrema
80+
function M.convert_dim_value(conversion::DQConversion, attr, values, last_values)
8281
if conversion.automatic_units
83-
conversion.quantity[] = oneunit(value_obs[][1])
82+
conversion.quantity[] = oneunit(first(values))
8483
end
85-
result = map(conversion.quantity, value_obs; ignore_equal_values=true) do unit, values
86-
if !isempty(values)
87-
# try if conversion works, to through error if not!
88-
# Is there a function for this to check in DynamicQuantities?
89-
unit_convert(unit, values[1])
90-
end
91-
return M.convert_dim_value(conversion, values)
84+
85+
unit = conversion.quantity[]
86+
if !isempty(values)
87+
# try if conversion works, to through error if not!
88+
# Is there a function for this to check in DynamicQuantities?
89+
unit_convert(unit, first(values))
9290
end
93-
append!(deregister, result.inputs)
94-
return result
91+
return unit_convert(conversion.quantity[], values)
9592
end
9693

9794
function M.convert_dim_value(conversion::DQConversion, values)
@@ -109,8 +106,7 @@ end
109106
using DynamicQuantities, Makie, Dates
110107
const DQConversion = Base.get_extension(DynamicQuantities, :DynamicQuantitiesMakieExt).DQConversion
111108

112-
@recipe(DQPlot, x) do scene
113-
return Attributes()
109+
@recipe DQPlot (x, y) begin
114110
end
115111

116112
function Makie.plot!(plot::DQPlot)

0 commit comments

Comments
 (0)