work on highlighting kitForNkit in charts
M src/Charting.elm +16 -9
@@ 22,7 22,8 @@ update msg cmodel =
             { cmodel | hovering = Just hoverData, chartType = ReworkShare }
 
         OnHoverInterrupted hoverData ->
-            { cmodel | hovering = Just hoverData, chartType = InterruptedShare}
+            { cmodel | hovering = Just hoverData, chartType = InterruptedShare }
+
 
 data =
     [ { round = 101, waitingNKIT = 85, doneNKIT = 117, waitingKIT = 14, doneKIT = 188 }

          
@@ 31,9 32,8 @@ data =
     , { round = 2001, waitingNKIT = 2000, doneNKIT = 2013, waitingKIT = 140, doneKIT = 3868 }
     ]
 
-
-twoLinesChart : ChartingModel -> List DoneData -> H.Html ChartingMsg
-twoLinesChart cmodel doneData =
+twoLinesChart : ChartingModel -> List DoneData -> List (Round, Round) -> H.Html ChartingMsg
+twoLinesChart cmodel doneData kitForNkitStates =
     let
         hoverVariant =
             case cmodel.chartType of

          
@@ 77,19 77,25 @@ twoLinesChart cmodel doneData =
         contentForInterrupted =
             dataPointsTwo "NKIT" .interruptedShareNKIT "KIT" .interruptedShareKIT
 
-        content =
+
+        rect r1 r2 yMax = C.rect [CA.x1 r1, CA.y1 0, CA.x2 r2, CA.y2 yMax, CA.color "rgb(210, 210, 210)", CA.opacity 0.3]
+
+        -- a: off -- empty list -- no problem
+        -- b: off, on, off until off round -- even -- no problem; edge case: multiple on and off in same round --> use last input
+        -- c: off, on -- ++ current round -- uneven -- add last round as end
+        (kitDataFunc, nkitDataFunc, content) =
             case cmodel.chartType of
                 HowMuchDone ->
-                    contentForDone
+                    (.doneKIT, .doneNKIT, contentForDone)
 
                 HowLongFloat ->
-                    contentForFloat
+                    (.flowtimeGKIT, .flowtimeGNKIT, contentForFloat)
 
                 ReworkShare ->
-                    contentForRework
+                    (.reworkShareKIT, .reworkShareNKIT, contentForRework)
 
                 InterruptedShare ->
-                    contentForInterrupted
+                    (.interruptedShareKIT, .interruptedShareNKIT, contentForInterrupted)
     in
     C.chart
         [ CA.height 200

          
@@ 99,6 105,7 @@ twoLinesChart cmodel doneData =
         ]
         [ C.xLabels [ CA.fontSize 12, CA.withGrid ]
         , C.yLabels [ CA.fontSize 12, CA.withGrid ]
+        , C.withPlane <| \p -> List.map (\(a,b) -> rect (toFloat <| max 1 a) (toFloat b) p.y.max) kitForNkitStates
         , content
         , C.each (Maybe.withDefault [] cmodel.hovering) <|
             \p item ->

          
M src/Field.elm +18 -6
@@ 72,18 72,22 @@ inflowToWip field =
 
 -- nkit
 
+
 markInterruptedProcessing : Job -> Job
-markInterruptedProcessing x = {x | conditions = {rework = x.conditions.rework, reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, interruptedProcessing = True}}
+markInterruptedProcessing x =
+    { x | conditions = { rework = x.conditions.rework, reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, interruptedProcessing = True } }
 
 
 incompleteReqsFromWipToW2 : Field -> Field
 incompleteReqsFromWipToW2 field =
     let
-        incompletes = List.map markInterruptedProcessing <| List.filter (\x -> x.conditions.reqs == Incomplete) field.wip
-        completes = List.filter (\x -> x.conditions.reqs == Complete) field.wip
+        incompletes =
+            List.map markInterruptedProcessing <| List.filter (\x -> x.conditions.reqs == Incomplete) field.wip
 
-     in
-    { field | w2 = field.w2 ++ incompletes, wip = completes}
+        completes =
+            List.filter (\x -> x.conditions.reqs == Complete) field.wip
+    in
+    { field | w2 = field.w2 ++ incompletes, wip = completes }
 
 
 type Changeability

          
@@ 253,7 257,15 @@ inflowToW2OrW0 field =
 
 
 applyStep : KITForNKIT -> ( FieldStep, FieldStep ) -> Model -> Model
-applyStep kitForNkit ( k, n ) model = let nkitFunction = if kitForNkit then k else n in
+applyStep kitForNkit ( k, n ) model =
+    let
+        nkitFunction =
+            if kitForNkit then
+                k
+
+            else
+                n
+    in
     case ( k, nkitFunction ) of
         ( Just x, Just y ) ->
             { model | kit = y model.kit, nkit = x model.nkit }

          
M src/Main.elm +32 -43
@@ 105,7 105,7 @@ update msg model =
 
             else
                 update (NextSteps (n - 1)) <| Tuple.first <| update (NextStep model.finishRound) model
-
+                
         Step s ->
             case s of
                 S0 ->

          
@@ 120,18 120,9 @@ update msg model =
 
                 S2 ->
                     -- S2 does S3
-                    let
-                        f =
-                            conditionalScrap model.scrapLimit >> justDoneToDone >> wipToJustDone model.round
-                    in
-                    ( chain <|
-                        applyStep model.kitForNkit
-                            ( Just f
-                            , Just f
-                            )
-                            model
-                    , Cmd.none
-                    )
+                    let f = conditionalScrap model.scrapLimit >> justDoneToDone >> wipToJustDone model.round in
+                    ( chain <| applyStep model.kitForNkit ( Just f,
+                                           Just f) model, Cmd.none )
 
                 -- FIXME: updatewaiting moves justDone to Done, which it shouldn't
                 S3 ->

          
@@ 201,8 192,14 @@ update msg model =
             else
                 defaultToCurrentModel <| Maybe.map (\y -> applyStep model.kitForNkit ( Just <| identifyScrap y, Just <| identifyScrap y ) <| { model | scrapLimit = Just y }) <| validIntInput 0 500 x
 
-        SwapKITForNKIT ->
-            ( { model | kitForNkit = not model.kitForNkit }, Cmd.none )
+        SwapKITForNKIT -> let newState = case model.kitForNkitState of
+                                           Nothing -> Just model.round
+                                           Just x -> Nothing
+                              addStates = case model.kitForNkitState of
+                                            Just x -> [(x, model.round)]
+                                            Nothing -> []
+                           in
+            ( { model | kitForNkit = not model.kitForNkit, kitForNkitState = newState, kitForNkitStates = model.kitForNkitStates ++ addStates}, Cmd.none )
 
         SwapAutoPlay ->
             ( { model | autoPlay = not model.autoPlay }, Cmd.none )

          
@@ 303,6 300,11 @@ viewWrapper x =
     }
 
 
+kitForNkitOpen : Maybe Round -> Round -> List (Round, Round)
+kitForNkitOpen r cr = case r of
+                        Just x -> [(x, cr)]
+                        Nothing -> []
+
 view : Model -> Document Msg
 view model =
     let

          
@@ 371,23 373,12 @@ view model =
         scrapLimitInterface =
             interface2 (String.fromInt <| Maybe.withDefault 0 model.scrapLimit) (Maybe.Extra.isNothing model.scrapLimit) [ text "scrap after", text "rounds" ] ChangedScrapLimit (text "rounds")
 
-        scrapShare =
-            case model.scrapLimit of
-                Nothing ->
-                    Element.none
-
-                Just _ ->
-                    let
-                        all =
-                            getAll model.nkit
-
-                        scrapped =
-                            List.filter (.conditions >> .scrapped) all
-
-                        share =
-                            (\x -> x * 100) <| safeDiv (toFloat <| List.length scrapped) (toFloat <| List.length all)
-                    in
-                    column [ width fill, height fill, spacing 5 ] [ text <| String.fromFloat share ++ "% of jobs", text "in NKIT scrapped" ]
+        scrapShare = case model.scrapLimit of
+                        Nothing -> Element.none
+                        Just _ -> let all = getAll model.nkit
+                                      scrapped = List.filter (.conditions >> .scrapped) all
+                                      share = (\x -> x *100) <| safeDiv (toFloat <| List.length scrapped) (toFloat <| List.length all)
+                                   in column [width fill, height fill, spacing 5] [text <| String.fromFloat share ++ "% of jobs", text "in NKIT scrapped"]
 
         batchButtons =
             let

          
@@ 466,16 457,16 @@ view model =
 
         playInterface =
             row [ spacing 10, padding 13, Font.size 12, width fill ]
-                [ column [ width fill, height fill, spacing 7 ] [ autoPlayer, kitForNkit ]
+                [ column [width fill, height fill, spacing 7] [autoPlayer, kitForNkit]
                 , reworkProbInterface
-                , column [ width fill, height fill, spacing 5 ] [ scrapLimitInterface, scrapShare ]
+                , column [width fill, height fill, spacing 5] [scrapLimitInterface, scrapShare]
 
                 --, stopThresholds
                 ]
 
         kitForNkit =
             row [ Font.size 12, spacing 10, width fill ]
-                [ column [ spacing 5, Border.width 1, padding 5 ] [ text "KIT4NKIT", swapKITForNKITButton ]
+                [ column [ spacing 5, Border.width 1, padding 5 ] [ text "KIT4NKIT", swapKITForNKITButton]
                 ]
 
         autoPlayer =

          
@@ 483,6 474,7 @@ view model =
                 [ column [ spacing 5, Border.width 1, padding 5 ] [ text "AutoPlay", autoPlayButton ]
                 ]
 
+
         --lower =
         --    row [ spacing 20, width fill, height fill ] [ viewField squareSizeUndone squareSizeDone model.nkit "NKIT", viewField squareSizeUndone squareSizeDone model.kit "KIT" ]
         netWidth =

          
@@ 502,10 494,6 @@ view model =
         -- round <| squareSize * 1.5
         outerPadding =
             20
-
-        theChart =
-            viewChart model.stats.doneData
-
         viewDoneStatWrapper f =
             Maybe.withDefault Element.none <| Maybe.map viewDoneStat <| List.head <| List.reverse <| f model
 

          
@@ 524,10 512,11 @@ view model =
                     column [ width fill, height fill, spacing 10 ] [ x, el [ paddingXY 10 0, Font.size 12 ] <| text t ]
 
                 headedChart t1 t2 x =
-                    column [ width fill, height fill, spacing 25 ] [ el [ paddingXY 10 0, Font.size 14, centerX ] <| column [ width fill, height fill ] [ text t1, text t2 ], theChart x ]
+                    column [ width fill, height fill, spacing 25 ] [ el [ paddingXY 10 0, Font.size 14, centerX ] <| column [ width fill, height fill ] [ text t1, text t2 ], viewChart model.stats.doneData x <| Debug.log "kitForNkitStates" (model.kitForNkitStates ++ kitForNkitOpen model.kitForNkitState model.round)]
+                --viewChart model.stats.doneData
             in
             column [ width fill, height fill, spacing 30 ]
-                [ cc [ headedChart "jobs in todo interrupted" "[%]" model.chart0, headedChart "How much gets done?" "[incoming jobs]" model.chart1, headedChart "How long does it take?" "[jobs > 4 cycles flow time]" model.chart3, headedChart "How much rework?" "[jobs requiring rework]" model.chart5 ]
+                [ cc [ headedChart "jobs in todo interrupted" "[%]" model.chart0, headedChart "How much gets done?" "[% incoming jobs]" model.chart1, headedChart "How long does it take?" "[jobs > 4 cycles flow time]" model.chart3, headedChart "How much rework?" "[jobs requiring rework]" model.chart5 ]
                 ]
 
         cy =

          
@@ 568,8 557,8 @@ viewDoneStat ds =
     column [ width fill, height fill ]
         [ r [ text "", c "throughput" "[jobs/cycle]", c "cap. utilisation" "[-]", c "avg. flow time" "[cycles/job]" ]
         , r [ text "inflow", text <| r2 ds.inflowedAvg, text "", text "" ]
-        , r [ text "todo", text <| ("+" ++ r2 ds.wipIncr), text "", text <| r2 ds.flowtimeWaiting ]
-        , r [ text "processing", text <| r2 ds.doneAvg, text <| r2 ds.capUtilisation, text <| r2 ds.flowtimeProcessingAvg ]
+        , r [ text "outflow", text <| r2 ds.doneAvg, text <| r2 ds.capUtilisation, text <| r2 ds.flowtimeProcessingAvg ]
+        , r [ text "+waiting", text <| ("+" ++ r2 ds.wipIncr), text "", text <| r2 ds.flowtimeWaiting ]
         , r [ text "total", text "", text "", text <| r2 <| ds.flowtimeWaiting + ds.flowtimeProcessingAvg ]
         ]
 

          
M src/Numbers.elm +7 -2
@@ 111,8 111,13 @@ decomposeNumber smaller5 xs todo =
     else
         decomposeNumber smaller5 (xs ++ [ addComponent ]) todoNew
 
-type alias BatchSize = Int
-type alias BatchCount = Int
+
+type alias BatchSize =
+    Int
+
+
+type alias BatchCount =
+    Int
 
 
 simplifyNumber : Bool -> Int -> List ( BatchSize, BatchCount )

          
M src/Rework.elm +22 -8
@@ 5,6 5,7 @@ import Random
 import Random.List
 import Types exposing (..)
 
+
 updateRework : Job -> ReworkCondition -> Job
 updateRework j rc =
     case j.conditions.rework of

          
@@ 23,6 24,7 @@ setRework p j =
         Random.weighted ( p, NeedsRework ) [ ( 100 - p, NoRework ) ]
 
 
+
 -- new setRework mechanism to improve perf with increasing no. of jobs on w0
 -- aim: constant computing amount for increasing no. of jobs on w0
 -- relevance: rework mechanism consumes ≈ half of computing time, which is the biggest chunk

          
@@ 80,9 82,13 @@ setReworks p ( kf, nkf ) =
 
 
 setReworksFieldWrapper : ProbPerRound -> Field -> Random.Generator Field
-setReworksFieldWrapper p field = case p < 0.0001 of
-                                    True -> Random.constant field
-                                    False -> detNoOfJobsRequiringRework p (List.length field.w0) |> Random.andThen (setReworksField field)
+setReworksFieldWrapper p field =
+    case p < 0.0001 of
+        True ->
+            Random.constant field
+
+        False ->
+            detNoOfJobsRequiringRework p (List.length field.w0) |> Random.andThen (setReworksField field)
 
 
 setReworksField : Field -> Int -> Random.Generator Field

          
@@ 99,11 105,19 @@ setReworkNew n =
     Random.map (\( a, b ) -> toRework a ++ b) << choices n
 
 
-choices : Int -> List a -> Random.Generator (List a, List a)
-choices n xs = case n of
-                0 -> Random.constant ([], xs)
-                _ -> let xs1 = Random.List.shuffle xs
-                      in Random.map2 Tuple.pair (Random.map (List.take n) xs1) (Random.map (List.drop n) xs1)
+choices : Int -> List a -> Random.Generator ( List a, List a )
+choices n xs =
+    case n of
+        0 ->
+            Random.constant ( [], xs )
+
+        _ ->
+            let
+                xs1 =
+                    Random.List.shuffle xs
+            in
+            Random.map2 Tuple.pair (Random.map (List.take n) xs1) (Random.map (List.drop n) xs1)
+
 
 setReworksCmd : Model -> Cmd Msg
 setReworksCmd model =

          
M src/Round.elm +9 -1
@@ 43,7 43,15 @@ fieldRound f r p l field =
 
 
 bothFieldsRound : KITForNKIT -> Round -> ProbPerRound -> Maybe ScrapLimit -> ( Field, Field, Stats ) -> Random.Generator ( Field, Field, Stats )
-bothFieldsRound kitForNkit r p l ( kf, nkf, stats ) = let nkitFunction = if kitForNkit then kitAfterReworks else nkitAfterReworks in
+bothFieldsRound kitForNkit r p l ( kf, nkf, stats ) =
+    let
+        nkitFunction =
+            if kitForNkit then
+                kitAfterReworks
+
+            else
+                nkitAfterReworks
+    in
     Random.map (\( a, b ) -> ( a, b, trackStats (r + 1) a b stats )) <| Random.map2 Tuple.pair (fieldRound kitAfterReworks r p l kf) (fieldRound nkitFunction r p l nkf)
 
 

          
M src/Stats.elm +7 -13
@@ 64,14 64,13 @@ countDones n f =
         <|
             getAll f
 
-
 safeDiv : Float -> Float -> Float
 safeDiv x y =
-    if y == 0 then
-        0
+            if y == 0 then
+                0
 
-    else
-        x / y
+            else
+                x / y
 
 
 createDataPoint : Round -> Field -> Field -> DoneData

          
@@ 84,14 83,9 @@ createDataPoint r kit nkit =
             safeDiv (100 * (toFloat <| List.length <| List.filter (\x -> x.conditions.rework /= NoRework) xs)) (toFloat <| List.length xs)
 
         interruptedShare field =
-            let
-                totalNumber =
-                    List.length field.w0
-
-                interrupted =
-                    List.length <| List.filter (\x -> x.conditions.interruptedProcessing) field.w0
-            in
-            (\x -> 100 * x) <| safeDiv (toFloat interrupted) (toFloat totalNumber)
+            let totalNumber = List.length field.w0
+                interrupted = List.length <| List.filter (\x -> x.conditions.interruptedProcessing) field.w0
+             in (\x -> 100 * x) <| safeDiv (toFloat interrupted) (toFloat totalNumber)
 
         flowtimeG n xs =
             safeDiv (100 * (toFloat <| List.length <| List.filter (\x -> x > n) xs)) (toFloat <| List.length xs)

          
M src/Types.elm +16 -8
@@ 8,15 8,18 @@ import Time
 
 
 type alias Model =
-    { viewport : Maybe Dom.Viewport, kit : Field, nkit : Field, round : Round, step : StepVariant, kitForNkit : Bool, finishRound : Bool, roundEmpty : Bool, stepEmpty : Bool, stopRoundEmpty : Bool, autoPlay : Bool, incrementMode : AutoPlayMode, reworkProbPerRound : Float, reworkProbPerRoundDot : Bool, reworkProbEmpty : Bool, scrapLimit : Maybe ScrapLimit, cyclesPerIncrement : Int, cyclesPerIncrementEmpty : Bool, chart0 : ChartingModel, chart1 : ChartingModel, chart3 : ChartingModel, chart5 : ChartingModel, stats : Stats }
+    { viewport : Maybe Dom.Viewport, kit : Field, nkit : Field, round : Round, step : StepVariant, kitForNkit : Bool, finishRound : Bool, roundEmpty : Bool, stepEmpty : Bool, stopRoundEmpty : Bool, autoPlay : Bool, incrementMode : AutoPlayMode, reworkProbPerRound : Float, reworkProbPerRoundDot : Bool, reworkProbEmpty : Bool, scrapLimit : Maybe ScrapLimit, cyclesPerIncrement : Int, cyclesPerIncrementEmpty : Bool, chart0 : ChartingModel, chart1 : ChartingModel, chart3 : ChartingModel, chart5 : ChartingModel, stats : Stats, kitForNkitState : Maybe Round, kitForNkitStates : List (Round, Round)}
+
 
 
 initChart : ChartType -> ChartingModel
 initChart chartType =
     { hovering = Nothing, chartType = chartType }
 
+
 chart0 : ChartingModel
-chart0 = initChart InterruptedShare
+chart0 =
+    initChart InterruptedShare
 
 
 chart1 : ChartingModel

          
@@ 36,14 39,17 @@ chart5 =
 
 initModel : Model
 initModel =
-    { viewport = Nothing, nkit = initField, kit = initField, round = 0, step = S7, kitForNkit = False, finishRound = False, roundEmpty = False, stepEmpty = False, stopRoundEmpty = False, autoPlay = False, incrementMode = RoundMode, reworkProbPerRound = 0.5, reworkProbPerRoundDot = False, reworkProbEmpty = False, scrapLimit = Nothing, cyclesPerIncrement = 1, cyclesPerIncrementEmpty = False, chart0 = chart0, chart1 = chart1, chart3 = chart3, chart5 = chart5, stats = { flowtimesSinglesNKIT = [], flowtimesSinglesKIT = [], justDonesNKIT = [], justDonesKIT = [], doneData = [] } }
+    { viewport = Nothing, nkit = initField, kit = initField, round = 0, step = S7, kitForNkit = False, finishRound = False, roundEmpty = False, stepEmpty = False, stopRoundEmpty = False, autoPlay = False, incrementMode = RoundMode, reworkProbPerRound = 0.5, reworkProbPerRoundDot = False, reworkProbEmpty = False, scrapLimit = Nothing, cyclesPerIncrement = 1, cyclesPerIncrementEmpty = False, chart0 = chart0, chart1 = chart1, chart3 = chart3, chart5 = chart5, stats = { flowtimesSinglesNKIT = [], flowtimesSinglesKIT = [], justDonesNKIT = [], justDonesKIT = [], doneData = [] }, kitForNkitState = Nothing, kitForNkitStates = [] }
 
 
 type AutoPlayMode
     = RoundMode
     | StepMode
 
-type alias KITForNKIT = Bool
+
+type alias KITForNKIT =
+    Bool
+
 
 type Msg
     = ReceivedViewport Dom.Viewport

          
@@ 253,10 259,12 @@ type alias RoundParameters =
 type alias NonRoundConditions =
     { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool }
 
---    = SquareFilling BorderColor Scrapped
+
 
+--    = SquareFilling BorderColor Scrapped
 -- toColorCombo : NonRoundConditions  -> ( SquareFilling, BorderColor, Scrapped )
 
+
 type alias Job =
     { conditions : NonRoundConditions, roundParams : RoundParameters }
 

          
@@ 273,17 281,17 @@ getIncomingRound j =
 
 icplNew : Int -> Job
 icplNew n =
-    { conditions = { reqs = Incomplete, rework = NoRework, scrapped = False , interruptedProcessing = False}, roundParams = { incomingRound = n, doneRound = Nothing } }
+    { conditions = { reqs = Incomplete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = n, doneRound = Nothing } }
 
 
 cplNew : Int -> Job
 cplNew n =
-    { conditions = { reqs = Complete, rework = NoRework, scrapped = False , interruptedProcessing = False}, roundParams = { incomingRound = n, doneRound = Nothing } }
+    { conditions = { reqs = Complete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = n, doneRound = Nothing } }
 
 
 cplDone : Int -> Int -> Job
 cplDone from to =
-    { conditions = { reqs = Complete, rework = NoRework, scrapped = False, interruptedProcessing = False}, roundParams = { incomingRound = from, doneRound = Just to } }
+    { conditions = { reqs = Complete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = from, doneRound = Just to } }
 
 
 icplDone : Int -> Int -> Job

          
M src/Views.elm +43 -21
@@ 33,10 33,12 @@ orange : Color
 orange =
     rgb255 255 153 0
 
+
 yellow : Color
 yellow =
     rgb255 255 255 0
 
+
 red : Color
 red =
     rgb255 230 74 69

          
@@ 118,12 120,11 @@ drawSquare : Square -> Int -> Element Ms
 drawSquare sq n =
     let
         attrs =
-            List.append [ width <| px n, height <| px n, Font.size 10, Font.center] color
+            List.append [ width <| px n, height <| px n, Font.size 10, Font.center ] color
 
-        ( color, optionalMega) =
+        ( color, optionalMega ) =
             squareToColor sq
 
-
         content =
             case optionalMega of
                 Nothing ->

          
@@ 135,21 136,28 @@ drawSquare sq n =
     el attrs content
 
 
+
 --squareToColor : Square -> List (Element.Attr)
 
 
 squareToColor sq =
     let
         incompleteReqs flavor =
-            [ Background.color grey, Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing]
+            [ Background.color grey, Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing ]
 
         completeReqs flavor =
-            [ Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing]
+            [ Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing ]
 
-        reqs flavor = case flavor.squareFilling of
-                Black -> incompleteReqs flavor -- .borderColor flavor.scrapped
-                White -> completeReqs flavor -- .borderColor flavor.scrapped
+        reqs flavor =
+            case flavor.squareFilling of
+                Black ->
+                    incompleteReqs flavor
 
+                -- .borderColor flavor.scrapped
+                White ->
+                    completeReqs flavor
+
+        -- .borderColor flavor.scrapped
         optionalMega x =
             case x of
                 Normal ->

          
@@ 160,11 168,12 @@ squareToColor sq =
     in
     case sq of
         RealSquare params ->
-            ( reqs params.flavor, optionalMega params.variant)
+            ( reqs params.flavor, optionalMega params.variant )
 
         PhantomSquare ->
             ( [], Nothing )
-            
+
+
 drawLineSquares : Int -> Int -> List (Element Msg)
 drawLineSquares lines perLine =
     List.repeat lines (drawSquareFullN perLine)

          
@@ 214,7 223,7 @@ type SquareFilling
 
 
 type Square
-    = RealSquare {variant: SquareVariant, flavor: VisualFlavor}
+    = RealSquare { variant : SquareVariant, flavor : VisualFlavor }
     | PhantomSquare
 
 

          
@@ 270,6 279,8 @@ drawField squareSize perRow field label 
     in
     column [ spacing 5 ] [ fieldContent, el [ Font.size 12, Element.moveRight 5 ] <| text label ]
 
+
+
 -- NonRoundConditions
 --    { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool }
 --    = SquareFilling BorderColor Scrapped

          
@@ 308,13 319,24 @@ toBorderType scr =
         False ->
             Border.solid
 
+
 toFontColor : Bool -> Color
-toFontColor x = if x then yellow else black
+toFontColor x =
+    if x then
+        yellow
+
+    else
+        black
 
-type alias VisualFlavor = {squareFilling : SquareFilling, borderColor : BorderColor, scrapped : Bool, interruptedProcessing : Color}
+
+type alias VisualFlavor =
+    { squareFilling : SquareFilling, borderColor : BorderColor, scrapped : Bool, interruptedProcessing : Color }
+
 
-toVisualFlavor : NonRoundConditions  -> VisualFlavor
-toVisualFlavor x = {squareFilling = toFillingColor x.reqs, borderColor = toBorderColor x.rework, scrapped = x.scrapped, interruptedProcessing = toFontColor x.interruptedProcessing}
+toVisualFlavor : NonRoundConditions -> VisualFlavor
+toVisualFlavor x =
+    { squareFilling = toFillingColor x.reqs, borderColor = toBorderColor x.rework, scrapped = x.scrapped, interruptedProcessing = toFontColor x.interruptedProcessing }
+
 
 isSet : NonRoundConditions -> Job -> Maybe Job
 isSet nrc j =

          
@@ 335,14 357,16 @@ visibleSquares smaller5 xs =
             List.map (\( x, ys ) -> ( toVisualFlavor <| .conditions x, (\z -> z + 1) <| List.length ys )) groups
 
         perGroup ( flavor, n ) =
-            List.concatMap (\( batchSize, batchCount ) -> List.repeat batchCount <| RealSquare {variant = Mega batchSize, flavor = flavor}) <| simplifyNumber smaller5 n
+            List.concatMap (\( batchSize, batchCount ) -> List.repeat batchCount <| RealSquare { variant = Mega batchSize, flavor = flavor }) <| simplifyNumber smaller5 n
     in
     List.concatMap perGroup counts
 
 
+
 --    { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool }
 --    = SquareFilling BorderColor Scrapped
 
+
 getThreeConditions : Job -> ( Scrapped, RequirementsCondition, ReworkCondition )
 getThreeConditions x =
     ( x.conditions.scrapped, x.conditions.reqs, x.conditions.rework )

          
@@ 682,13 706,11 @@ stat t f model df =
     line t (String.fromFloat a) (String.fromFloat b) c
 
 
-
 -- TODO: make chartingmodel dynamic to each chart (is now one for all), i.e. pipe in dedicated chartmodel for each chart (that needs to be stored in master model)
 
-
-viewChart : List DoneData -> ChartingModel -> Element Msg
-viewChart dd cm =
-    el [ height fill, width fill, Border.width 1, Border.solid, Border.color black ] << Element.html << Html.map (ChartingMsgWrapper cm.chartType) <| Charting.twoLinesChart cm dd
+viewChart : List DoneData -> ChartingModel -> List (Round, Round) -> Element Msg
+viewChart dd cm kitForNkitStates =
+    el [ height fill, width fill, Border.width 1, Border.solid, Border.color black ] << Element.html << Html.map (ChartingMsgWrapper cm.chartType) <| Charting.twoLinesChart cm dd kitForNkitStates
 
 
 viewScatter : Model -> Mode -> Element Msg