Skip to content
Snippets Groups Projects
Commit bd5bc264 authored by Edward Sabinus's avatar Edward Sabinus
Browse files

Added new data type

parent 3bf0e614
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ main =
-- MODEL
type alias Model = { httpState : HttpState
, fullTexts : List {description: String, data: String}
, data : List Data
, data : List OldData
, error : String
}
......@@ -51,7 +51,17 @@ type Arrangement
= Line_By_Line
| Forth_Loop
type alias Data = {description: String, data: List ( String, Maybe Float )}
type alias OldData = {description: String, data: List ( String, Maybe Float )}
type alias Data = { gender: String
, race: String
, parentEducation: String
, lunch: String
, testPreparation: String
, mathScore: String
, readingScore: String
, writingScore: String
}
filesToLoad =
[ "StudentsPerformance.csv"
......@@ -93,7 +103,7 @@ updateModel msg model =
, fullTexts = checkedFullTexts
, data = prepareData <|
List.map
(\data -> Data data.description <| csvString_to_data data.data)
(\data -> OldData data.description <| csvString_to_data data.data)
checkedFullTexts
}
else{ model | httpState = Loading (filesLeft-1)
......@@ -180,14 +190,14 @@ viewArrangement arrangement drawList =
) (coordsListToListOfLines drawList)
]
viewDataWithDescription : (Int,Int) -> List ( Int, Int ) -> Data -> Html Msg
viewDataWithDescription : (Int,Int) -> List ( Int, Int ) -> OldData -> Html Msg
viewDataWithDescription (w,h) drawList zeitreihe =
Html.div []
[ Html.h4 [] [Html.text zeitreihe.description]
, viewData (w,h) drawList zeitreihe
]
viewData : (Int,Int) -> List ( Int, Int ) -> Data -> Html Msg
viewData : (Int,Int) -> List ( Int, Int ) -> OldData -> Html Msg
viewData (w,h) drawList zeitreihe =
Html.div [] [svg [ viewBox 0 0 (toFloat w) (toFloat h)
, TypedSvg.Attributes.width <| TypedSvg.Types.Percent 100
......@@ -267,7 +277,7 @@ decodeStockDay =
)
)
prepareData : List Data -> List Data
prepareData : List OldData -> List OldData
prepareData rawData =
let startDate = Date.fromCalendarDate 1980 Dec 23
untilDate = Date.fromCalendarDate 2011 Jun 9
......@@ -299,7 +309,7 @@ dataToString dataList =
<| List.map
(\elem -> (Tuple.first elem)++" "++
(let rightString = String.fromFloat <| Maybe.withDefault -1234879231 <| Tuple.second elem
in if rightString == "-1234879231" then "No Data" else rightString
in if rightString == "-1234879231" then "No OldData" else rightString
)++"\n"
)
dataList
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment