Etop.Chart (Etop v0.5.3)
Create ASCII charts.
Examples
iex> data = for i <- 1..30, do: i * 2 + :rand.uniform(4) - 2
iex> labels = for {_, i} <- Enum.with_index(data), do: "Label #{i}"
iex> Etop.Chart.puts(data, labels: labels, title: "Test Plot")
Test Plot
---------
64 | *
60 | *
56 | * *
52 | * * *
48 | *
44 | * *
40 | *
36 | * * * *
32 | *
28 | * *
24 | * *
20 | * *
16 | * *
12 | * *
8 | * * *
4 | *
0 |
+-------------------+-------------------+-------------------+--
Label 10 Label 20
Link to this section Summary
Link to this section Functions
Link to this function
generate(items, opts \\ [])
Write a chart of the given data to the console.
Creates a plot of some time scale data with the following features:
- plot title
- configurable chart height and width
- performs y axis down scaling to fit to the given width
- performs x axis down-scaling by taking the max of values in the scaling group
- Performs y axis lower bound truncating (0, min..max)
- x scale label prefix
- option x axis labels (defaults to the series number if not provided)
Options
- height (20 default) - the height of the y axis
- width (100) - the width of the x axis
- y_label_postfix ("") - the appended y axis label
- title (nil) - Sting printed at the top of the chart
- labels (nil) - List of x-axis labels
- empty_char (0x20 - space) - the character for an empty char
- plot_char (?*) - the character for a plot point
Examples
iex> data = Enum.to_list(1..20)
iex> labels = for i <- data, do: "Label #{i}"
iex> Etop.Chart.puts(data, labels: label)
Link to this function
puts(items, opts \\ [])
Generate and print a chart.
Calls generate/2 and prints the result.
See Etop.Chart.generate/2 for more information.