GetBrandsFromData: Identify brand names from the input data

View source: R/usetemplate.R

GetBrandsFromDataR Documentation

Identify brand names from the input data

Description

Extracts the names (not necessarily brands) of the data series from the input data, to be associated with different colors. This usually corresponds to columns in the input table. But for charts such as 'Pyramid' or 'Pie', each entry in the vector (or each row in the table) corresponds to a new data series. This function should not called directly, but instead be called via GetVectorOfColors instead. It remains an exported function because it is used in older versions of the Standard R pages

Usage

GetBrandsFromData(
  data,
  filter,
  chart.type,
  scatter.colors.column = 4,
  multi.color.series = FALSE,
  type = "Series"
)

Arguments

data

Input data for the visualization. The is usually a vector or table. It should be normalized from flipChart::PrepareData.

filter

Optional filter which can be used with the input data. The label of the filter is used when appropriate.

chart.type

Type of chart to plot

scatter.colors.column

For scatterplot data, the column of data which is used to determine the colors of each point.

multi.color.series

For bar and column charts, a logical indicating how colors are used. By default, this value is set to FALSE, in which case the number of colors returned is equal to the number of data series (or columns) in data. When multi.color.series == TRUE, multiple colors are assigned to the categories within a single data series, so the number of colors returned is equal to NROW(data).

type

Describes the type of data which the color vector will be applied to. One of "Series" or "Pie subslice". By default, type is set to "Series", in which case the return value assigns a different color for each data series. When chart.type == "Pie", type can be set to "Pie subslice" and the return value assigns a color for each subslice of the Pie.

Value

An integer specifying the number of colors used by the chart.


Displayr/flipChartBasics documentation built on Feb. 26, 2024, 12:35 a.m.