From edf717544ccd0d1a64c0592c827a379d25b3dd86 Mon Sep 17 00:00:00 2001 From: tomschindler <tom.schindler@student.uni-halle.de> Date: Wed, 26 Jun 2024 14:11:40 +0200 Subject: [PATCH] Kommentare entfernt und Types imported --- public/main.js | 4 ++-- src/Main.elm | 38 ++------------------------------------ src/Scatterplot.elm | 37 +------------------------------------ src/SmartPhoneType.elm | 27 +++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 74 deletions(-) create mode 100644 src/SmartPhoneType.elm diff --git a/public/main.js b/public/main.js index 35434d6..a59ab94 100644 --- a/public/main.js +++ b/public/main.js @@ -6935,7 +6935,7 @@ var $BrianHicks$elm_csv$Csv$Decode$decodeCsv = $BrianHicks$elm_csv$Csv$Decode$de { fieldSeparator: _Utils_chr(',') }); -var $author$project$Main$Smartphone = function (id) { +var $author$project$SmartPhoneType$Smartphone = function (id) { return function (brand) { return function (model) { return function (price) { @@ -7492,7 +7492,7 @@ var $author$project$Main$decoder = A2( $BrianHicks$elm_csv$Csv$Decode$field, 'id', $BrianHicks$elm_csv$Csv$Decode$blank($BrianHicks$elm_csv$Csv$Decode$string)), - $BrianHicks$elm_csv$Csv$Decode$into($author$project$Main$Smartphone))))))))))))))))))))))); + $BrianHicks$elm_csv$Csv$Decode$into($author$project$SmartPhoneType$Smartphone))))))))))))))))))))))); var $author$project$Main$parseCSV = function (csv) { return A3($BrianHicks$elm_csv$Csv$Decode$decodeCsv, $BrianHicks$elm_csv$Csv$Decode$FieldNamesFromFirstRow, $author$project$Main$decoder, csv); }; diff --git a/src/Main.elm b/src/Main.elm index 0d9364a..ddb4c6c 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -5,7 +5,8 @@ import Csv.Decode as Decode exposing (Decoder) import Html exposing (Html, div) import Http import Result exposing (Result(..)) -import Scatterplot exposing (Msg(..)) +import Scatterplot exposing (Msg(..), ScatterPlotOption) +import SmartPhoneType exposing (Smartphone) @@ -18,33 +19,6 @@ main = -- MODEL --- ohne ram,display - - -type alias Smartphone = - { id : Maybe String - , brand : Maybe String - , model : Maybe String - , price : Maybe Float - , rating : Maybe Float - , g5 : Maybe Bool - , nfc : Maybe Bool - , ir_blaster : Maybe Bool - , processor_name : Maybe String - , processor_brand : Maybe String - , num_cores : Maybe Float - , processor_speed : Maybe Float - , battery : Maybe Float - , fast_charging : Maybe Float - , memory : Maybe Float - , ram : Maybe Float - , screen_size : Maybe Float - , resolution : Maybe String - , refresh_rate : Maybe Float - , camera : Maybe String - , card : Maybe String - , os : Maybe String - } type alias Model = @@ -55,14 +29,6 @@ type alias Model = } -type alias ScatterPlotOption = - { attribute1 : String - , attribute2 : String - , att1List : List (Maybe Float) - , att2List : List (Maybe Float) - } - - init : () -> ( Model, Cmd Msg ) init _ = ( Model [] Nothing "" { attribute1 = "Price", attribute2 = "Rating", att1List = [], att2List = [] }, fetchData ) diff --git a/src/Scatterplot.elm b/src/Scatterplot.elm index 6d4695e..26e017e 100644 --- a/src/Scatterplot.elm +++ b/src/Scatterplot.elm @@ -5,6 +5,7 @@ import Html exposing (Html, option) import Html.Attributes exposing (value) import Html.Events exposing (onInput) import Scale exposing (ContinuousScale) +import SmartPhoneType exposing (Smartphone) import Statistics import TypedSvg exposing (circle, g, style, svg, text_) import TypedSvg.Attributes exposing (class, fontFamily, fontSize, textAnchor, transform, viewBox) @@ -29,36 +30,6 @@ type alias ScatterPlotOption = } - --- ohne ram,display - - -type alias Smartphone = - { id : Maybe String - , brand : Maybe String - , model : Maybe String - , price : Maybe Float - , rating : Maybe Float - , g5 : Maybe Bool - , nfc : Maybe Bool - , ir_blaster : Maybe Bool - , processor_name : Maybe String - , processor_brand : Maybe String - , num_cores : Maybe Float - , processor_speed : Maybe Float - , battery : Maybe Float - , fast_charging : Maybe Float - , memory : Maybe Float - , ram : Maybe Float - , screen_size : Maybe Float - , resolution : Maybe String - , refresh_rate : Maybe Float - , camera : Maybe String - , card : Maybe String - , os : Maybe String - } - - w : Float w = 900 @@ -92,9 +63,6 @@ defaultExtent = scatterplot : XyData -> Svg msg scatterplot model = let - -- kreisbeschriftung : String - -- kreisbeschriftung = - -- (Maybe.withDefault (Point "Nothing" 0 0) (List.head model.data)).pointName xValues : List Float xValues = List.map .x model.data @@ -111,9 +79,6 @@ scatterplot model = yScaleLocal = yScale yValues - -- half : ( Float, Float ) -> Float - -- half t = - -- (Tuple.second t - Tuple.first t) / 2 labelPositions : { x : Float, y : Float } labelPositions = { x = wideExtent xValues |> Tuple.second diff --git a/src/SmartPhoneType.elm b/src/SmartPhoneType.elm new file mode 100644 index 0000000..c717574 --- /dev/null +++ b/src/SmartPhoneType.elm @@ -0,0 +1,27 @@ +module SmartPhoneType exposing (..) + + +type alias Smartphone = + { id : Maybe String + , brand : Maybe String + , model : Maybe String + , price : Maybe Float + , rating : Maybe Float + , g5 : Maybe Bool + , nfc : Maybe Bool + , ir_blaster : Maybe Bool + , processor_name : Maybe String + , processor_brand : Maybe String + , num_cores : Maybe Float + , processor_speed : Maybe Float + , battery : Maybe Float + , fast_charging : Maybe Float + , memory : Maybe Float + , ram : Maybe Float + , screen_size : Maybe Float + , resolution : Maybe String + , refresh_rate : Maybe Float + , camera : Maybe String + , card : Maybe String + , os : Maybe String + } -- GitLab