Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update examples in subdirectories for Elm 0.19 #1

Open
wants to merge 1 commit into
base: update-examples-elm-0.19
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions examples/Docs/Axis/Example3.elm
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,27 @@ chart =

xAxisConfig : Axis.Config Data msg
xAxisConfig =
Axis.time 650 "Date" .date
Axis.time Time.utc 650 "Date" (toFloat << Time.posixToMillis << .date)
-- Change the `dateInterval` function to change the dates!


dateInterval : Int -> Time.Time
-- Creates a magic time interval
dateInterval : Float -> Time.Posix
dateInterval i =
-- 4 * year + toFloat i * 21 * year
-- 20 * day + toFloat i * 8 * day
4 * Time.hour + toFloat i * 21 * Time.hour
let
magicHoursInterval =
4 + i * 21 -- Feel free to change this
in
magicHoursInterval |> hoursToMillis |> Time.millisToPosix


day : Time.Time
day =
24 * Time.hour


year : Time.Time
year =
356 * day

-- Converts hours to miliseconds
hoursToMillis : Float -> Int
hoursToMillis h =
h * millisPerHour |> round

millisPerHour =
60 * 60 * 1000

-- DATA

Expand All @@ -81,7 +81,7 @@ type alias Data =
, weight : Float
, height : Float
, income : Float
, date : Time.Time
, date : Time.Posix
}


Expand Down
25 changes: 14 additions & 11 deletions examples/Docs/Axis/Example4.elm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type alias Data =
, weight : Float
, height : Float
, income : Float
, date : Time.Time
, date : Time.Posix
}


Expand Down Expand Up @@ -98,17 +98,20 @@ average =
, Data 46 85 1.82 70667 (dateInterval 2)
]


dateInterval : Int -> Time.Time
-- Creates a magic time interval
dateInterval : Float -> Time.Posix
dateInterval i =
4 * year + toFloat i * 21 * year

let
magicHoursInterval =
4 + i * 21 -- Feel free to change this
in
magicHoursInterval |> hoursToMillis |> Time.millisToPosix

day : Time.Time
day =
24 * Time.hour

-- Converts hours to miliseconds
hoursToMillis : Float -> Int
hoursToMillis h =
h * millisPerHour |> round

year : Time.Time
year =
356 * day
millisPerHour =
60 * 60 * 1000
26 changes: 15 additions & 11 deletions examples/Docs/Axis/Example5.elm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ main =
chart : Html.Html msg
chart =
LineChart.viewCustom
{ x = Axis.time 650 "Date" .date
{ x = Axis.time Time.utc 650 "Date" (toFloat << Time.posixToMillis << .date)
, y = yAxisConfig
, container = Container.default "line-chart-1"
, interpolation = Interpolation.default
Expand Down Expand Up @@ -63,7 +63,7 @@ type alias Data =
, weight : Float
, height : Float
, income : Float
, date : Time.Time
, date : Time.Posix
}


Expand Down Expand Up @@ -99,16 +99,20 @@ average =
]


dateInterval : Int -> Time.Time
-- Creates a magic time interval
dateInterval : Float -> Time.Posix
dateInterval i =
4 * year + toFloat i * 21 * year
let
magicHoursInterval =
4 + i * 21 -- Feel free to change this
in
magicHoursInterval |> hoursToMillis |> Time.millisToPosix


day : Time.Time
day =
24 * Time.hour
-- Converts hours to miliseconds
hoursToMillis : Float -> Int
hoursToMillis h =
h * millisPerHour |> round


year : Time.Time
year =
356 * day
millisPerHour =
60 * 60 * 1000
28 changes: 16 additions & 12 deletions examples/Docs/Axis/Example6.elm
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ xAxisConfig : Axis.Config Data msg
xAxisConfig =
Axis.custom
{ title = Title.default "Year"
, variable = Just << .date
, variable = Just << (toFloat << Time.posixToMillis << .date)
, pixels = 700
, range = Range.padded 20 20
, axisLine = AxisLine.full Colors.black
, ticks = Ticks.time 5
, ticks = Ticks.time Time.utc 5
}


Expand All @@ -74,7 +74,7 @@ type alias Data =
, weight : Float
, height : Float
, income : Float
, date : Time.Time
, date : Time.Posix
}


Expand Down Expand Up @@ -110,16 +110,20 @@ average =
]


dateInterval : Int -> Time.Time
-- Creates a magic time interval
dateInterval : Float -> Time.Posix
dateInterval i =
4 * year + toFloat i * 21 * year
let
magicHoursInterval =
4 + i * 21 -- Feel free to change this
in
magicHoursInterval |> hoursToMillis |> Time.millisToPosix


day : Time.Time
day =
24 * Time.hour
-- Converts hours to miliseconds
hoursToMillis : Float -> Int
hoursToMillis h =
h * millisPerHour |> round


year : Time.Time
year =
356 * day
millisPerHour =
60 * 60 * 1000
25 changes: 14 additions & 11 deletions examples/Docs/AxisLine/Example1.elm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type alias Data =
, weight : Float
, height : Float
, income : Float
, date : Time.Time
, date : Time.Posix
}


Expand Down Expand Up @@ -129,17 +129,20 @@ average =
, Data 46 85 1.82 70667 (dateInterval 2)
]


dateInterval : Int -> Time.Time
-- Creates a magic time interval
dateInterval : Float -> Time.Posix
dateInterval i =
4 * year + toFloat i * 21 * year

let
magicHoursInterval =
4 + i * 21 -- Feel free to change this
in
magicHoursInterval |> hoursToMillis |> Time.millisToPosix

day : Time.Time
day =
24 * Time.hour

-- Converts hours to miliseconds
hoursToMillis : Float -> Int
hoursToMillis h =
h * millisPerHour |> round

year : Time.Time
year =
356 * day
millisPerHour =
60 * 60 * 1000
2 changes: 1 addition & 1 deletion examples/Docs/Colors/Example1.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Docs.LineChart.Example6 exposing (main)
module Docs.Colors.Example1 exposing (main)


import Html
Expand Down
2 changes: 1 addition & 1 deletion examples/Docs/Container/Example3.elm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ chart =
containerConfig : Container.Config msg
containerConfig =
Container.custom
{ attributesHtml = [ Html.Attributes.style [ ( "font-family", "monospace" ) ] ]
{ attributesHtml = [ Html.Attributes.style "font-family" "monospace" ]
, attributesSvg = []
, size = Container.static
, margin = Container.Margin 30 100 60 80
Expand Down
3 changes: 2 additions & 1 deletion examples/Docs/Dots/Example3.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Docs.Dots.Example3 exposing (main)

import Browser
import Html
import Html.Attributes exposing (class)
import LineChart
Expand All @@ -21,7 +22,7 @@ import LineChart.Axis.Intersection as Intersection



main : Program Never Model Msg
main : Program () Model Msg
main =
Browser.sandbox
{ init = init
Expand Down
3 changes: 2 additions & 1 deletion examples/Docs/Dots/Example4.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Docs.Dots.Example4 exposing (main)

import Browser
import Html
import Html.Attributes exposing (class)
import LineChart
Expand All @@ -21,7 +22,7 @@ import LineChart.Axis.Intersection as Intersection



main : Program Never Model Msg
main : Program () Model Msg
main =
Browser.sandbox
{ init = init
Expand Down
5 changes: 3 additions & 2 deletions examples/Docs/Dots/Example5.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Docs.Dots.Example3 exposing (main)
module Docs.Dots.Example5 exposing (main)

import Browser
import Html
import Html.Attributes exposing (class)
import LineChart
Expand All @@ -21,7 +22,7 @@ import LineChart.Axis.Intersection as Intersection



main : Program Never Model Msg
main : Program () Model Msg
main =
Browser.sandbox
{ init = init
Expand Down
5 changes: 3 additions & 2 deletions examples/Docs/Dots/Example6.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Docs.Dots.Example3 exposing (main)
module Docs.Dots.Example6 exposing (main)

import Browser
import Html
import Html.Attributes exposing (class)
import LineChart
Expand All @@ -21,7 +22,7 @@ import LineChart.Axis.Intersection as Intersection



main : Program Never Model Msg
main : Program () Model Msg
main =
Browser.sandbox
{ init = init
Expand Down
3 changes: 2 additions & 1 deletion examples/Docs/Events/Example1.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Docs.Events.Example1 exposing (main)

import Browser
import Html
import Html.Attributes exposing (class)
import LineChart
Expand All @@ -21,7 +22,7 @@ import LineChart.Axis.Intersection as Intersection



main : Program Never Model Msg
main : Program () Model Msg
main =
Browser.sandbox
{ init = init
Expand Down
3 changes: 2 additions & 1 deletion examples/Docs/Events/Example2.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Docs.Events.Example2 exposing (main)

import Browser
import Html
import Html.Attributes exposing (class)
import LineChart
Expand All @@ -21,7 +22,7 @@ import LineChart.Axis.Intersection as Intersection



main : Program Never Model Msg
main : Program () Model Msg
main =
Browser.sandbox
{ init = init
Expand Down
3 changes: 2 additions & 1 deletion examples/Docs/Events/Example3.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Docs.Events.Example3 exposing (main)

import Browser
import Html
import Html.Attributes exposing (class)
import LineChart
Expand All @@ -21,7 +22,7 @@ import LineChart.Axis.Intersection as Intersection



main : Program Never Model Msg
main : Program () Model Msg
main =
Browser.sandbox
{ init = init
Expand Down
3 changes: 2 additions & 1 deletion examples/Docs/Events/Example4.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Docs.Events.Example4 exposing (main)

import Browser
import Html
import Html.Attributes exposing (class)
import LineChart
Expand All @@ -21,7 +22,7 @@ import LineChart.Axis.Intersection as Intersection



main : Program Never Model Msg
main : Program () Model Msg
main =
Browser.sandbox
{ init = init
Expand Down
Loading