Expresso.Element.Chart.Scatter.Data (expresso v0.1.0)

Copy Markdown View Source

The points of a scatter plot from the rows of a CSV file

The first row holds the headings, and each other row is one point. The options label, x, y, symbol, color and size of the chart name the column of each value, so a deck can show different columns of one file:

OptionThe columnThe default
labelThe name of the pointThe first column
xThe x value, a number"x"
yThe y value, a number"y"
symbolA category of the symbolNo symbol
colorA category of the colorNo color
sizeThe size, a number more than zeroNo size
framesThe label of the frame of the rowNo frames

An empty cell of the symbol or of the color gives the point no category. A column of the color with a number in each cell that is not empty gives each point a color from a number, on the scale of the color_scale option. With frames, each row is a point in one frame, and the function returns each point with the label of its frame.

Summary

Functions

Return the points of the rows of a CSV file

Functions

points(list, src, columns)

@spec points([{pos_integer(), [String.t()]}], String.t(), keyword()) ::
  {:ok, [Expresso.Element.Point.t() | {String.t(), Expresso.Element.Point.t()}]}
  | {:error, String.t()}

Return the points of the rows of a CSV file

rows are the rows of Expresso.Element.Chart.Csv.rows/3, with the headings first. columns holds the options of the chart that name the columns.

iex> rows = [{1, ["service", "cost", "load"]}, {2, ["api", "1200", "840"]}]
iex> {:ok, [point]} = Expresso.Element.Chart.Scatter.Data.points(rows, "a.csv", x: "cost", y: "load")
iex> {point.name, point.x, point.y}
{"api", 1200, 840}