Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playground: Bugfix for the balances chart. #831

Merged
merged 1 commit into from
Apr 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions plutus-playground-client/src/Chain.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ import Control.Monad.Aff.Class (class MonadAff)
import Data.Array as Array
import Data.Generic (gShow)
import Data.Int as Int
import Data.Lens (_1, _2, filtered, to, toListOf, traversed, view)
import Data.Lens (_1, to, toListOf, traversed, view)
import Data.List (List)
import Data.List as List
import Data.Maybe (Maybe(Nothing))
import Data.Maybe (Maybe(..), maybe)
import Data.Newtype (unwrap)
import Data.Traversable (traverse_)
import Data.Tuple (fst)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import ECharts.Commands (addItem, addLink, axisLine, axisType, backgroundColor, bar, bottom, buildItems, buildLinks, color, colorSource, colors, formatterString, items, label, left, lineStyle, name, nameGap, nameLocationMiddle, nameRotate, normal, right, sankey, series, sourceName, splitLine, targetName, textStyle, tooltip, top, trigger, value, xAxis, yAxis) as E
import ECharts.Extras (focusNodeAdjacencyAllEdges, orientVertical, positionBottom)
import ECharts.Internal (undefinedValue)
import ECharts.Monad (CommandsT, DSL) as E
import ECharts.Types (AxisType(Value, Category), PixelOrPercent(Pixel), TooltipTrigger(ItemTrigger), numItem, strItem) as E
import ECharts.Types (Item(..))
import ECharts.Types.Phantom (I)
import Halogen (HTML)
import Halogen.Component (ParentHTML)
Expand Down Expand Up @@ -227,7 +229,9 @@ currencySeries wallets target =
<<< _simulatorWalletBalance
<<< _value
<<< _LedgerMap
<<< traversed
<<< filtered ((==) target <<< fst)
<<< _2
<<< to (E.numItem <<< Int.toNumber)) wallets
<<< to (Array.find ((==) target <<< fst))
<<< to (maybe nullItem (E.numItem <<< Int.toNumber <<< snd)))
wallets

nullItem :: Item
nullItem = Item undefinedValue