Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Nov 22, 2022
1 parent aa84a18 commit f702fb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/backends/plotly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,10 @@ plotly_data(v::AbstractArray{R}) where {R<:Rational} = float(v)
plotly_native_data(axis::Axis, a::Surface) = Surface(plotly_native_data(axis, a.surf))
plotly_native_data(axis::Axis, data::AbstractArray) =
if !isempty(axis[:discrete_values])
construct_categorical_data(data, axis)
map(
xi -> axis[:discrete_values][searchsortedfirst(axis[:continuous_values], xi)],
data,
)
elseif axis[:formatter] in (datetimeformatter, dateformatter, timeformatter)
plotly_convert_to_datetime(data, axis[:formatter])
else
Expand Down
9 changes: 3 additions & 6 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1073,10 +1073,7 @@ function shape_data(series, expansion_factor = 1)
)
end

construct_categorical_data(x::AbstractArray, axis::Axis) =
(map(xi -> axis[:discrete_values][searchsortedfirst(axis[:continuous_values], xi)], x))

function add_triangle!(I::Int, i::Int, j::Int, k::Int, x, y, z, X, Y, Z)
function _add_triangle!(I::Int, i::Int, j::Int, k::Int, x, y, z, X, Y, Z)
m = 4(I - 1) + 1
n = m + 1
o = m + 2
Expand All @@ -1101,7 +1098,7 @@ function mesh3d_triangles(x, y, z, cns::Tuple{Array,Array,Array})
Y = zeros(eltype(y), 4length(cj))
Z = zeros(eltype(z), 4length(ck))
@inbounds for I in eachindex(ci) # connections are 0-based
add_triangle!(I, ci[I] + 1, cj[I] + 1, ck[I] + 1, x, y, z, X, Y, Z)
_add_triangle!(I, ci[I] + 1, cj[I] + 1, ck[I] + 1, x, y, z, X, Y, Z)
end
X, Y, Z
end
Expand All @@ -1111,7 +1108,7 @@ function mesh3d_triangles(x, y, z, cns::AbstractVector{NTuple{3,Int}})
Y = zeros(eltype(y), 4length(cns))
Z = zeros(eltype(z), 4length(cns))
@inbounds for I in eachindex(cns) # connections are 1-based
add_triangle!(I, cns[I]..., x, y, z, X, Y, Z)
_add_triangle!(I, cns[I]..., x, y, z, X, Y, Z)
end
X, Y, Z
end
Expand Down

0 comments on commit f702fb9

Please sign in to comment.