This is the histogram chart module from elm-chart-builder.
The histogram bar chart can both generate the histogram data automatically or accept preprocessed data.
The data accessor for generating a histogram from pre-processed data.
Meaning the data has already been bucketed and counted.
values here is not used and always passed as an empty array.
preProcessedDataAccessor =
Histo.preProcessedDataAccessor
(\d ->
{ x0 = d.bucket
, x1 = d.bucket + 0.1
, values = []
, length = d.count
}
)Initializes the histogram bar chart with a default config.
Histo.init requiredConfig
|> Histo.render ( data, accessor )Renders the histogram
Histo.init requiredConfig
|> Histo.render ( data, accessor )Build an alternative table content for accessibility
⚠ This is still work in progress and only a basic table is rendered with this option. For now it is best to only use it with a limited number of data points.
Histo.init requiredConfig
|> Histo.withTable
|> Histo.render ( data, accessor )Set the domain for the HistogramGenerator. All values falling outside the domain will be ignored.
Histo.init requiredConfig
|> Histo.withDomain ( 0, 1 )
|> Histo.render ( data, accessor )Set the histogram color
Histo.init requiredConfig
|> Histo.withColor (Color.rgb255 240 59 32)
|> Histo.render ( data, accessor )Sets an accessible title for the svg chart. Default value: ""
Histo.init requiredConfig
|> Histo.withTitle "This is a chart"
|> Histo.render ( data, accessor )Sets an accessible, long-text description for the svg chart. Default value: ""
Histo.init requiredConfig
|> Histo.withDesc "This is an accessible chart, with a desc element"
|> Histo.render ( data, accessor )Sets the formatting for the Y axis ticks.
Defaults to Scale.tickFormat
formatter =
Numeral.format "0%"
Histo.init requiredConfig
|> Histo.withYAxisTickFormat formatter
|> Histo.render (data, accessor)Passes the tick values for the Y axis.
Defaults to elm-visualization Scale.ticks.
Histo.init requiredConfig
|> Histo.withYAxisTicks [ 1, 2, 3 ]
|> Histo.render ( data, accessor )Sets the approximate number of ticks for the Y axis.
Defaults to elm-visualization Scale.tickCount.
Histo.init requiredConfig
|> Histo.withYAxisTickCount 5
|> Histo.render ( data, accessor )Hide all axis.
Histo.init requiredConfig
|> Histo.hideAxis
|> Histo.render ( data, accessor )Hide the Y aixs.
Histo.init requiredConfig
|> Histo.hideYAxis
|> Histo.render ( data, accessor )Hide the X aixs.
Histo.init requiredConfig
|> Histo.hideXAxis
|> Histo.render ( data, accessor )
The data accessor for generating a histogram. It takes a config that is separate from the general config, because it is only used when generating a histogram and not for bucketed pre-processed data.