Skip to content

Tmw/linreg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linreg

A simple linear regression model built using Elixir and made interactive and visual using Phoenix LiveView. Read the blogposts here

Example

To start

  1. Clone this repo
  2. cd into linreg
  3. Start the Phoenix server: mix phx.server
  4. Play around with it over at http://localhost:4000

Troubleshooting

Clicks not appearing

If you've been following the blogpost and it doesn't appear to register clicks, it is probably due to an update in Phoenix Live View (since 0.13.0) where the metadata of each event is not included by default anymore. To fix this; open up assets/js/app.js and find the line where it says let liveSocket = new LiveSocket(..snip..) and replace it with:

let liveSocket = new LiveSocket("/live", Socket, {
  params: {_csrf_token: csrfToken},
  metadata: {
    click: (e, _el) => {
      return {
        offsetX: e.offsetX,
        offsetY: e.offsetY
      }
    }
  }
})

Thanks to @rinbo for making me aware

License

MIT

About

Linear Regression using Elixir and Phoenix Liveview

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published