terezka / elm-charts

Create SVG charts in Elm.
https://www.elm-charts.org
BSD 3-Clause "New" or "Revised" License
698 stars 67 forks source link

Upgrade elm-plot to 0.19.1? #120

Open vistuleB opened 1 year ago

vistuleB commented 1 year ago

The old Elm-plot looks more intuitive/human to me, and Chart.Attributes.amount is not working for me.

Is there any way we could get an upgrade to 0.19.1?

vistuleB commented 1 year ago

Here's an MWE of the issue I encountered with Chart.Attributes.amount; I wanted the axes/grid ticks to appear 0, 6, 12, 18, 24 but they keep on appearing at 0, 5, 10, 15, 20:

module Main exposing (..)

import Browser
import Chart as C
import Chart.Attributes as CA
import Html exposing (Html, div)
import Html.Attributes exposing (style)

type alias Model =
    {}

type Msg
    = Msg

main : Program () Model Msg
main =
    Browser.element
        { init = init
        , update = update
        , subscriptions = \_ -> Sub.none
        , view = view
        }

init : () -> ( Model, Cmd Msg )
init _ =
    ( {}, Cmd.none )

update : Msg -> Model -> ( Model, Cmd Msg )
update _ model =
    ( model, Cmd.none )

view : Model -> Html Msg
view _ =
    let
        data =
            [ { x = 0, y = 0 }
            , { x = 24, y = 10 }
            ]
    in
    div
        [ style "width" "300px"
        , style "height" "300px"
        , style "padding" "50px"
        ]
        [ C.chart
            [ CA.height 300
            , CA.width 300
            ]
            [ C.xLabels
                [ CA.withGrid
                , CA.amount 5
                ]
            , C.yLabels
                [ CA.withGrid ]
            , C.series .x [ C.scatter .y [] ] data
            ]
        ]
vistuleB commented 1 year ago

I'm going to start a separate issue for the MWE above, for visibility / clarity.