Skip to content

Commit

Permalink
Release v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mindok committed May 31, 2023
1 parent 1694b02 commit 0f6abe3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ContEx Change Log

## v0.5.0 : In Progress
## v0.5.0 : 2023-05-31

- NOTE: behaviour change. If a `Dataset` is made up of rows of maps, `column_names` now returns headers if it is supplied, otherwise returns
map keys from the first row. Previously, it just returned the map keys from the first row.
Expand Down Expand Up @@ -35,15 +35,15 @@ may push the plot content beyond the bottom of the plot.
- Added `LinePlot` (finally)
- Make stroke width for `LinePlot` adjustable through options. Thanks @littleStudent.
- Handle nil values in `LinePlot` by creating gaps in line.
- Stop crash on timescales when interval clashes with days in month resulting in invalid date. Thanks @imsoulfly.
- Stop crash on timescales when interval clashes with days in month resulting in invalid date. Thanks @imsoulfly.
- Fix colour palette option in `GanttChart`.

### Deprecated
- Most of the options set via functions, e.g. `BarChart.colours/2`. Use the options in the relevant `new` functions instead.

## v0.3.0 : 2020-06-08
- Allow Dataset to be created from a list of Maps (previously lists of lists and list of tuples were supported)
- Implement a data mapping mechanism to provide a consistent way of mapping data into required plot elements. Thanks
- Implement a data mapping mechanism to provide a consistent way of mapping data into required plot elements. Thanks
@srowley for breaking the back of this.
- Added simplified chart creation API. Thanks @srowley. The existing API remains as-is
- Added test coverage for some components. Thanks @srowley
Expand Down
26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ContEx is a simple server side charting package for elixir. See these demos on t

## Core concepts

### Dataset
### Dataset
ContEx uses a simple `Dataset` structure - a list of lists or a list of tuples together with a list of column names.

For example:
Expand All @@ -32,16 +32,16 @@ Will make a new point plot with the first column used for the x-axis, the second

Each module has different option. For example, `BarChart` allows you to set the `:padding` between the bar groups, specify whether you want `:type` to be `:grouped` or `:stacked`. The options are described in each module's documentation and are set in `new/2`.

`DataSet` columns are mapped to the attributes each different chart type expects. For example, a `PointPlot` expects an x column and at
least one y column. These are set up by passing a `:mapping` option in the options when creating a new chart. For example,
`DataSet` columns are mapped to the attributes each different chart type expects. For example, a `PointPlot` expects an x column and at
least one y column. These are set up by passing a `:mapping` option in the options when creating a new chart. For example,

```elixir
chart = PointPlot.new(
dataset,
mapping: %{x_col: :column_a, y_cols: [:column_b, column_c]}
)
```
It isn't necessary to supply a mapping unless the `DataSet` is a list of maps. If no mapping is provided, columns will be allocated
It isn't necessary to supply a mapping unless the `DataSet` is a list of maps. If no mapping is provided, columns will be allocated
automatically. For a `PointPlot`, the first column will be used for x, and the second for y.

Each chart type implements the `PlotContent` protocol which requires it to scale to a defined height and width, emit SVG and optionally emit SVG for a legend. Generally, you won't directly access this protocol however, because...
Expand All @@ -56,7 +56,7 @@ plot = Plot.new(600, 400, point_plot)
|> Plot.plot_options(%{legend_setting: :legend_right})
|> Plot.titles("My first plot", "With a fancy subtitle")

Plot.to_svg(plot)
Plot.to_svg(plot)
#^ This generates something like {:safe, "<svg> fancy SVG chart rendering stuff representing your plot</svg>"}
```

Expand Down Expand Up @@ -101,9 +101,9 @@ There are quite a few things to tidy up to make this ready for the real world, a
- [ ] Plot options
- [ ] Colour handling
- [ ] Plot overlays (e.g. line chart on bar chart)
- [x] SVG generation is poorly structured - lots of string interpolation.
- [x] SVG generation is poorly structured - lots of string interpolation.
- [ ] Benchmarks - particularly for the situation where large datasets are getting updated frequently and served via LiveViews.
- [x] Pie Charts
- [x] Pie Charts


## Installation
Expand All @@ -114,7 +114,7 @@ by adding `contex` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:contex, "~> 0.4.0"}
{:contex, "~> 0.5.0"}
]
end
```
Expand All @@ -128,12 +128,4 @@ _Pure Elixir Alternatives_

- [GGity](https://github.com/srowley/ggity) - modelled on [ggplot2](https://ggplot2.tidyverse.org/
- [PlotEx](https://github.com/elcritch/plotex) - has good line & time-series support and more optimised for certain situations.
- [Sasa Juric Homebrew](https://github.com/sasa1977/demo_system/) - graph.html.leex has examples of injecting data into SVGs for very specific use cases.








- [Sasa Juric Homebrew](https://github.com/sasa1977/demo_system/) - graph.html.leex has examples of injecting data into SVGs for very specific use cases.
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Contex.MixProject do
def project do
[
app: :contex,
version: "0.4.0",
version: "0.5.0",
elixir: "~> 1.9",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit 0f6abe3

Please sign in to comment.