Genie Discord forum

Author AvatarMordegai
9/13/2023, 3:35:24 PM

I'm trying to create a graph with more than one collection of data on it. When I look at some example code on I see the following code:

good_bad_plot = [
       y=collect(values(credit_no_by_age(filtered_data; good_rating=true))),
       name="Good credits",
       y=collect(values(credit_no_by_age(filtered_data; good_rating=false))),
       name="Bad credits",

and in the html file:


So I figured adding PlotData structs to an array is the way to go so I implemented it as follows:

inequality_data = [
  PlotData(x = x_axis, y = data.bottom_0_1),
  PlotData(x = x_axis, y = data.top_0_1)]

and in the html file:

<plotly :data="inequality_data"></plotly>

But then I get the following error:

Error: 2023-09-13 17:23:10 Error attempting to invoke handler 3 for field Reactive{Bool}(Observable(true), 1, false, false, "/Users/stef/.julia/geniebuilder/apps/happonomycockpit/app/inequality/app.jl:67") with value true
└ @ Stipple ~/.julia/packages/Stipple/v8vUW/src/stipple/mutators.jl:36
┌ Error: 2023-09-13 17:23:11 
│   exception =
│    MethodError: Cannot `convert` an object of type Vector{PlotData} to an object of type PlotData

Why would it work in the example and not in my code? What's the difference?

Author Avatarjeremiedb
9/18/2023, 11:23:08 PM

In your example:

<plotly :data="inequality_plot_data"></plotly>

you seem to be missing the required layout component. I'd try to have something like:


For reference: