Code Monkey home page Code Monkey logo

fable-recharts's People

Contributors

alfonsogarciacaro avatar dependabot[bot] avatar mangelmaxime avatar projecteon avatar saboco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fable-recharts's Issues

Fable.Recharts

Hello!
I try currently to use this module, but it throws strange errors.
This is my example: https://github.com/funkr/Try

The errors are easy to reproduce.

  1. Create a new project with this template SAFE-StackWebAppv2.1.0 (Rider Default Template)
  2. dotnet add package Fable.Recharts
  3. dotnet restore
  4. Add open Fable.Recharts and barChart [] [] to index.fs
  5. dotnet fake build --target run

Specifically the last errors looks concerning.

ERROR in ./src/Client/Index.fs
Module not found: Error: Can't resolve 'recharts' in 'C:\Projects\fsharp\Try\Berta\src\Client'
@ ./src/Client/Index.fs 46:0-36 139:187-195
@ ./src/Client/App.fs
@ ./src/Client/Client.fsproj
Child html-webpack-plugin for "index.html":
1 asset
Entrypoint undefined = index.html
[./node_modules/html-webpack-plugin/lib/loader.js!./src/Client/index.html] 662 bytes {0} [built]
[./node_modules/lodash/lodash.js] 530 KiB {0} [built]
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {0} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {0} [built]
i 「wdm」: Failed to compile.
Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\pagefile.sys'
Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\swapfile.sys'

Using Cartesian.Ticks doesn't work

When using `Cartesian.Ticks [|...|] on an axis doesn't work and produces the following error:

Failed prop type: Invalid prop ticks of type object supplied to YAxis, expected array

How can I dynamically determine chart lines at run time?

I have the following type

type ReadingValue = {
    SensorName:string
    ReadingName:string
    ReadingDate:DateTime
    ReadingValue:float
}

and the following test function to generate a chart

let lineChartSample (dataOpt:ReadingValue [] option) =
    match dataOpt with
    |Some data ->
        let filteredData = data |> Array.filter (fun r -> r.ReadingName = "Humid")
        lineChart
            [ margin 5. 20. 5. 0.
              Chart.Width 600.
              Chart.Height 300.
              Chart.Data filteredData
              Chart.OnClick onMouseEvent ]
            [ line
                [ Cartesian.Type Monotone
                  Cartesian.DataKey "ReadingValue"
                  P.Stroke "#8884d8"
                  Cartesian.Dot false
                  P.StrokeWidth 2. ]
                []
              xaxis [ Cartesian.DataKey "ReadingDate"] []
              yaxis [] []
        ]
    |_ -> Notification.notification [] [str "No data available"]

In general, I don't know the distinct values of ReadingName at design time.
But I want to allow the user to select different reading names to add to a single chart. How can I do this given F# is a statically typed language? I would need to dynamically pivot the data so that values associated with each reading name appear in different columns. This wouldn't be too difficult in a dynamic language but F# wants me to define my types in advance.

I see from the Recharts docs that dataKey can take a function. I've been able to find an example of this so I don't know what it does, but could it potentially be useful here?

Line chart does not display data in Sample

When following the sample within the SAFE template, the line chart did not render and produced this error message in the browser console:

warning: React does not recognize the dataKey prop on a DOM element

There was a reference to an issue here. My code base had the open statement in the Index.fs file as below:

open System
open Elmish
open Fable.Core
open Fable.Remoting.Client
open Fable.Recharts
open Fable.Recharts.Props
open Fable.React
open Fable.React.Props

The workaround was to re-organize the open statements like so:

open System
open Elmish
open Fable.Core
open Fable.Remoting.Client
open Fable.React
open Fable.React.Props
open Fable.Recharts
open Fable.Recharts.Prop

This order rendered the line correctly

ActiveIndex should be an array and handle multiples values in it.

I'm moving the discussion here as the PR for sample2 it's already merged.


ActiveIndex was an Array before. The problem is that ActiveShape wasn't being fired in the initial load. Also while working with array it only works with one value in it, passing two or more prevents the ActiveShape to be fired.

Changing the type of ActiveIndex from Array to int gets the whole thing working.

The problem is that recharts accepts also an Array of number so several shapes can be active at the same time and ActiveShape will be fired for each index in the array

I'm not sure on how to debug this, so if you have some tips so I can help it would be great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.