miladamilli / pie_chart_maker

Pie Chart Maker using Elixir, Phoenix LiveView and SVG. (Demo: https://art-code.herokuapp.com/piechart)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pie Chart Maker

This is my entry in Phoenix Phrenzy, showing off what Phoenix and LiveView can do.

Pie Chart Maker preview

A Pie Chart Maker with several predefined styles and an option to create custom styles for the items.

Pie slices are generated as SVG paths.

Try it online

Pie Chart Maker Demo

How to use

Edit the input and the application will automatically recalculate the percents and update the chart.

Switch between 3 styles

  • basic: 36 predefined basic colors.
  • funky: Random selection of funky colors.
  • pie: :-) Items use specific styles predefined in .css.

The Pie style :-)

Item's name == name of a .css class.
So you can easily create custom styles for the items. (Edit /assets/css/app.css file. Add the custom classes at the end of the file, after the default ones, for this to work.)

If there is no predefined style for the item, it will use one of the basic colors.

Currently there are a few predefined styles: strawberry, banana, blueberry, kiwi etc.

They use SVG patterns, for example:
.strawberry {fill: url("#strawberry");}

The patterns are defined in /templates/page/piechart_patterns.html.leex.

The Usual README Content

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Install Node.js dependencies with cd assets && npm install
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

About

Pie Chart Maker using Elixir, Phoenix LiveView and SVG. (Demo: https://art-code.herokuapp.com/piechart)


Languages

Language:Elixir 64.5%Language:CSS 24.5%Language:JavaScript 6.9%Language:HTML 4.2%