kikytokamuro/elm-linerbar/1.0.0

NOTE: the latest version is 1.0.1

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/KikyTokamuro/elm-linerbar.

What we checked: The repo moved to github.com/KikyTokamuro/elm-linerbar. Rebuilt with git archive from commit 12297e889f1c of https://github.com/KikyTokamuro/elm-linerbar (zip prefix KikyTokamuro-elm-linerbar-12297e8/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 1f684f6e3590fad340324a35dab3552372da5a66.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/kikytokamuro/elm-linerbar/zipball/1.0.0/

LinerBar

This module provides a customizable linear bar chart component.

It allows you to display data as a horizontal bar chart with interactive legend items that highlight corresponding bars.

View

view : Model -> Html Msg

Renders the LinerBar component.

  • model: The current LinerBar model.

This function uses the LinerBarStyles module to apply styles to the different parts of the chart.

Data

type alias Model =
{ data : Data
, activatedItem : Maybe String
, hoveredItem : Maybe String
}

Represents the overall state of the LinerBar component.

type alias Data =
{ title : Maybe String
, items : List Item
, dark : Bool
}

Represents the data used to populate the LinerBar.

type alias Item =
{ name : String
, value : Float
, color : String
}

Represents a single item within the LinerBar data.

Messages

type Msg

Represents the possible messages that can be sent to update the LinerBar.

Initialization

init : Data -> Model

Initializes the LinerBar model with the data.

- `data`: The initial data for the LinerBar.


Example:


import LinerBar


initialModel : LinerBar.Model
initialModel =
    LinerBar.init myData

Update

update : Msg -> Model -> Model

Updates the LinerBar model based on the given message.

- `msg`: The message to process.
- `model`: The current LinerBar model.


The function handles the following messages:


- `ActivateDeactivateItem id`: Toggles the active state of the item with the given ID.
- `HoverItem id`: Sets the hovered item to the item with the given ID.
- `LeaveItem`: Clears the hovered item.