<commit_before>module Chart exposing (lineChart)

import Html
import Svg exposing (..)
import Svg.Attributes exposing (..)
import List


lineChart points =
    let
        chartHeight =
            400

        min =
            Maybe.withDefault 0 <| List.minimum <| List.map (\p -> p.overtime - p.compensation) points

        max =
            Maybe.withDefault 0 <| List.maximum <| List.map (\p -> p.overtime - p.compensation) points

        heightScale =
            scale min max 0 chartHeight
    in
        svg [ viewBox ("0 " ++ toString (abs (heightScale min) - 50) ++ " 2100 500") ]
            (List.indexedMap
                (\i p ->
                     g [ class "o-90"]
                        [ rect
                            [ x (toString (i * 40))
                            , y (toString (computeY heightScale chartHeight (p.overtime - p.compensation)))
                            , width "30"
                            , height (toString (abs (heightScale (p.overtime - p.compensation))))
                            , fill "#eee"
                            , stroke "black"
                            , strokeWidth "0.2"
                            , class "dim"
                            ]
                            []
                        , text_
                            [ x (toString ((toFloat i) * 40.0 + 15))
                            , y (toString ((computeY heightScale chartHeight (p.overtime - p.compensation)) + (abs (heightScale (p.overtime - p.compensation)) / 2)))
                            , textAnchor "middle"
                            ]
                            [ text (toString (p.overtime - p.compensation)) ]
                        , text_
                            [ x (toString ((toFloat i) * 40.0 + 15))
                            , y (toString (chartHeight + abs (heightScale min) + 50))
                            , textAnchor "middle"
                            ]
                            [ text (toString i) ]
                        ]
                )
                points
            )


scale : Float -> Float -> Float -> Float -> (Float -> Float)
scale domainMin domainMax rangeMin rangeMax input =
    input * (rangeMax - rangeMin) / (domainMax - domainMin)


computeY heightScale chartHeight overtime =
    if (overtime < 0) then
        chartHeight
    else
        chartHeight - heightScale overtime
<commit_msg>Adjust styling<commit_after>module Chart exposing (lineChart)

import Html
import Svg exposing (..)
import Svg.Attributes exposing (..)
import List


lineChart points =
    let
        chartHeight =
            400

        min =
            Maybe.withDefault 0 <| List.minimum <| List.map (\p -> p.overtime - p.compensation) points

        max =
            Maybe.withDefault 0 <| List.maximum <| List.map (\p -> p.overtime - p.compensation) points

        heightScale =
            scale min max 0 chartHeight

        svgYOffset =
            toString (abs (heightScale min) - 50)
    in
        svg [ viewBox ("0 " ++ svgYOffset ++ " 2100 550") ]
            (List.indexedMap
                (\i p ->
                    g [ class "o-90" ]
                        [ rect
                            [ x (toString (i * 40))
                            , y (toString (computeY heightScale chartHeight (p.overtime - p.compensation)))
                            , width "35"
                            , height (toString (abs (heightScale (p.overtime - p.compensation))))
                            , fill "#eee"
                            , stroke "black"
                            , strokeWidth "0.3"
                            , class "dim"
                            ]
                            []
                        , text_
                            [ x (toString ((toFloat i) * 40 + 17.5))
                            , y (toString ((computeY heightScale chartHeight (p.overtime - p.compensation)) + (abs (heightScale (p.overtime - p.compensation)) / 2) + 5))
                            , textAnchor "middle"
                            ]
                            [ text (toString (p.overtime - p.compensation)) ]
                        , text_
                            [ x (toString ((toFloat i) * 40 + 17.5))
                            , y (toString (chartHeight + abs (heightScale min) + 50))
                            , textAnchor "middle"
                            ]
                            [ text (toString i) ]
                        , text_
                            [ x "1050"
                            , y (toString (chartHeight + abs (heightScale min) + 80))
                            , textAnchor "middle"
                            ]
                            [ text "Weeks" ]
                        ]
                )
                points
            )


scale : Float -> Float -> Float -> Float -> (Float -> Float)
scale domainMin domainMax rangeMin rangeMax input =
    input * (rangeMax - rangeMin) / (domainMax - domainMin)


computeY heightScale chartHeight overtime =
    if (overtime < 0) then
        chartHeight
    else
        chartHeight - heightScale overtime

{'fraction_non_alphanumeric': 0.09410166860690726, 'fraction_numerical': 0.016103996895615057, 'mean_word_length': 1.0003880481179666, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '270982', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1227, 'n_words': 346}