Skip to content

Commit

Permalink
🧩 [add-unused]: Drawable2 instance for LineChart.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolyp committed Aug 22, 2024
1 parent 4900d6d commit 2420fdf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/App/View/LineChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,4 @@ function drawLineChart_ (
}

export var drawLineChart = x1 => x2 => x3 => x4 => drawLineChart_(x1, x2, x3, x4)
export var drawLineChart2 = x1 => x2 => x3 => x4 => drawLineChart_(x1, x2, x3, x4)
15 changes: 14 additions & 1 deletion src/App/View/LineChart.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Prelude hiding (absurd)

import App.Util (class Reflect, SelState, Selectable, 𝕊, colorShade, from, get_intOrNumber, isPersistent, isPrimary, isSecondary, isTransient, record)
import App.Util.SelSetter (ViewSelSetter, field, lineChart, linePoint, listElement)
import App.View.Util (class Drawable, Renderer, selListener, uiHelpers)
import App.View.Util (class Drawable, class Drawable2, Renderer, Renderer2, selListener, selListener2, uiHelpers)
import Bind ((↦))
import Data.Foldable (maximum, minimum)
import Data.Int (toNumber)
Expand All @@ -23,6 +23,8 @@ newtype LineChart = LineChart
, plots :: Array LinePlot
}

newtype LineChartState = LineChartState Unit

newtype LinePlot = LinePlot
{ name :: Selectable String
, points :: Array Point
Expand Down Expand Up @@ -78,6 +80,7 @@ lineChartHelpers =
point_smallRadius = 2

foreign import drawLineChart :: LineChartHelpers -> Renderer LineChart
foreign import drawLineChart2 :: LineChartHelpers -> Renderer2 LineChart LineChartState

instance Drawable LineChart where
draw rSpec figVal _ redraw =
Expand All @@ -87,6 +90,16 @@ instance Drawable LineChart where
point { i, j } =
linePoint j >>> listElement i >>> field f_plots >>> lineChart

instance Drawable2 LineChart LineChartState where
draw2 rSpec figVal _ redraw =
drawLineChart2 lineChartHelpers uiHelpers rSpec =<< selListener2 figVal redraw point
where
point :: ViewSelSetter PointCoordinate
point { i, j } =
linePoint j >>> listElement i >>> field f_plots >>> lineChart

initialState = LineChartState unit

instance Reflect (Dict (Val (SelState 𝕊))) Point where
from r = Point
{ x: get_intOrNumber f_x r
Expand Down

0 comments on commit 2420fdf

Please sign in to comment.