No I haven't. Thanks for sharing. I'll keep an eye on it but I doubt I'd 
add it to the project.

On Sunday, April 30, 2017 at 9:03:09 PM UTC-4, Dustin Farris wrote:
>
> Also, have you seen elm-plot?
>
> https://terezka.github.io/elm-plot/
>
> I haven't played with it yet, but it looks pretty neat.  Might help with 
> some of your features that used highcharts?
>
> Dustin
>
>
> Sent from my iPhone
>
> On Apr 30, 2017, at 8:10 PM, Dwayne Crooks <[email protected] 
> <javascript:>> wrote:
>
> I posted here as the other thread seems to be closed off from replies.
>
> For this particular app I'm writing/porting the SPA from scratch to Elm 
> and the formatting issue was the first small hiccup I ran into. As 
> suggested in the other thread I went ahead and wrote the code I needed in 
> Elm.
>
> Here it is in case anyone else is interested:
>
> module Format exposing (asMoney)
>>
>> asMoney : Float -> String
>> asMoney value =
>>     let
>>         totalCents = round (value * 100)
>>         dollars = totalCents // 100
>>         cents = totalCents % 100
>>     in
>>         "$" ++ (groupBy 3 ',' dollars) ++ "." ++ (zeroPad 2 cents)
>>
>> groupBy : Int -> Char -> Int -> String
>> groupBy per sep n =
>>     let
>>         pow10 = 10 ^ per
>>     in
>>         if n < pow10 then
>>             toString n
>>         else
>>             zeroPad 3 (n % pow10)
>>                 |> String.cons sep
>>                 |> String.append (groupBy per sep <| n // pow10)
>>
>> zeroPad : Int -> Int -> String
>> zeroPad k n = String.padLeft k '0' (toString n)
>
>
> *P.S.* *Dustin, I decided to write one for myself. But thanks.*
>
> My next task is to draw some charts using Highcharts. I expect ports would 
> be the approach here so I'm crossing my fingers and hoping it all works 
> out. I certainly won't want to be re-writing parts of Highcharts at this 
> point.
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to