Woody88

Woody88

Any good graph library?

Are there any elixir graph Library? Can’t seem to find any so I was thinking of maybe implementating a small library using plotly.js and electron. I wanted to use wxWidget but people don’t seem to favor it.

Can anyone tell me if there are any existing library? If not, what do you think of I’m suggestion about implementing it with poorly.js and electron?

Thanks all!

Most Liked Responses

kokolegorille

kokolegorille

Phoenix socket javascript has been extracted from Phoenix here and thus can be used outside of framework… in an Electron application for example, or Swift, or React Native.

If you want to go the API way, axios will allow You to query your API phoenix backend.

I have been using Electron apps w/ Phoenix without problem, connecting Electron apps to a Phoenix auth API to get a token first, and then using secured socket to transmit data.

Woody88

Woody88

Thanks a lot for the npm package. I think that I got everything setup but every time that my electron app tries to connect to my phx channel I get this error.

[error] Ranch protocol #PID<0.304.0> (:cowboy_protocol) of listener PhxPlotEx.Web.Endpoint.HTTP terminated
** (exit) exited in: Phoenix.Endpoint.CowboyWebSocket.resume()
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function PhxPlotEx.PlotlyChannel.__socket__/1 is undefined (module PhxPlotEx.PlotlyChannel is not available)
            PhxPlotEx.PlotlyChannel.__socket__(:private)
            (phoenix) lib/phoenix/socket/transport.ex:237: Phoenix.Socket.Transport.build_channel_socket/4
            (phoenix) lib/phoenix/socket/transport.ex:242: Phoenix.Socket.Transport.do_dispatch/3
            (phoenix) lib/phoenix/transports/websocket.ex:123: Phoenix.Transports.WebSocket.ws_handle/3
            (phoenix) lib/phoenix/endpoint/cowboy_websocket.ex:77: Phoenix.Endpoint.CowboyWebSocket.websocket_handle/3
            (cowboy) /home/woodson/Dev/Elixir/phx_plot_ex/deps/cowboy/src/cowboy_websocket.erl:588: :cowboy_websocket.handler_call/7
            (phoenix) lib/phoenix/endpoint/cowboy_websocket.ex:49: Phoenix.Endpoint.CowboyWebSocket.resume/3
            (cowboy) /home/woodson/Dev/Elixir/phx_plot_ex/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

This what my setup looks like

const Socket = require('phoenix-socket').Socket

let socket = new Socket("ws://localhost:4000/socket")
socket.connect()

let channel = socket.channel("plotly:lobby", {})
channel.join()
  .receive("ok", resp => { console.log("Joined successfully", resp) })
  .receive("error", resp => { console.log("Unable to join", resp) })

Got any idea on how I can solve this? I really don’t understand how the sockets work in the background so I do not know where or why it’s looking for function PhxPlotEx.PlotlyChannel.__socket__.

Edit: Dammit I figured it out. I forgot that I was using phx 1.3 so I was defining the channel as channel "plotly:*", PhxPlotEx.PlotlyChannel instead of channel "plotly:*", PhxPlotEx.Web.PlotlyChannel

Thanks again for the tip!!

Where Next?

Popular in Questions Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New

We're in Beta

About us Mission Statement