Skip to content

Commit

Permalink
Add to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
alcwhite committed Nov 1, 2021
1 parent 433a0df commit 65fa0fd
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 31 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ basic chart package Uncharted and adapts Uncharted charts for display as compone
- The Bar Chart
- The Column Chart
- The Doughnut Chart
- The Funnel Chart
- The Horizontal Funnel Chart
- The Line Chart
- The Pie Chart
- The Progress Chart
Expand Down
101 changes: 70 additions & 31 deletions uncharted_phoenix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,37 +294,6 @@ column_chart = %BaseChart{
}
```

### Adding Stacked Sections to the Column or Bar Chart
![Stacked Column Chart](assets/images/stacked-column-chart.jpg "Stacked Column Chart")
You can add sections to a column or bar chart by adding a sections array to the dataset.

```elixir
column_chart = %BaseChart{
title: "Cheese Coney Consumption by Neighborhood",
colors: colors,
dataset: %ColumnChart.Dataset{
axes: %BaseAxes{
magnitude_axis: %MagnitudeAxis{
max: 10_000,
min: 0
}
},
sections: [
%Section{fill_color: :blue_gradient, label: "June", index: 1},
%Section{fill_color: :red_gradient, label: "July", index: 2},
%Section{fill_color: :rose_gradient, label: "May", index: 0}
],
data: ~w(Landen Oakley Downtown Florence Erlanger)
|> Enum.map(fn neighborhood ->
%BaseDatum{
name: neighborhood,
values: [:rand.uniform() * 4_000, :rand.uniform() * 3_000, :rand.uniform() * 3_000]
}
end)
}
}
```

### The Doughnut Chart
![Doughnut Chart](assets/images/doughnut-chart.jpg "Doughnut Chart")

Expand Down Expand Up @@ -377,6 +346,76 @@ doughnut_chart = %BaseChart{
}
```

### Funnel and Horizontal Funnel Chart
![Funnel Chart](assets/images/funnel-chart.jpg "Funnel Chart")
![Horizontal Funnel Chart](assets/images/horizontal-funnel-chart.jpg "Horizontal Funnel Chart")
```elixir
%BaseChart{
title: "Live Beam Memory Stats",
colors: @colors,
dataset: %FunnelChart.Dataset{
axes: %BaseAxes{
magnitude_axis: %MagnitudeAxis{
max: MemoryChart.chart_max(memory_data),
min: 0,
line_color: :line_blue,
display_lines: false
}
},
data: Enum.sort(data, & Enum.sum(&1.values) > Enum.sum(&2.values))
}
}
end

%BaseChart{
title: "Live Beam Memory Stats",
colors: @colors,
dataset: %HorizontalFunnelChart.Dataset{
axes: %BaseAxes{
magnitude_axis: %MagnitudeAxis{
max: MemoryChart.chart_max(memory_data),
min: 0,
line_color: :line_blue,
display_lines: false
}
},
data: Enum.sort(data, & Enum.sum(&1.values) > Enum.sum(&2.values))
}
}
end
```

### Adding Stacked Sections to the Column, Bar, Funnel, or Horizontal Funnel Chart
![Stacked Column Chart](assets/images/stacked-column-chart.jpg "Stacked Column Chart")
You can add sections to a column, bar, or funnel chart by adding a sections array to the dataset.

```elixir
column_chart = %BaseChart{
title: "Cheese Coney Consumption by Neighborhood",
colors: colors,
dataset: %ColumnChart.Dataset{
axes: %BaseAxes{
magnitude_axis: %MagnitudeAxis{
max: 10_000,
min: 0
}
},
sections: [
%Section{fill_color: :blue_gradient, label: "June", index: 1},
%Section{fill_color: :red_gradient, label: "July", index: 2},
%Section{fill_color: :rose_gradient, label: "May", index: 0}
],
data: ~w(Landen Oakley Downtown Florence Erlanger)
|> Enum.map(fn neighborhood ->
%BaseDatum{
name: neighborhood,
values: [:rand.uniform() * 4_000, :rand.uniform() * 3_000, :rand.uniform() * 3_000]
}
end)
}
}
```

### Base Chart Colors
Base chart configuration allows you to define set solid colors and gradients for any chart you will use within the application.

Expand Down
Binary file added uncharted_phoenix/assets/images/funnel-chart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 65fa0fd

Please sign in to comment.