Skip to content

Instantly share code, notes, and snippets.

@andredublin
Created September 18, 2017 02:14
Show Gist options
  • Save andredublin/d2df0826ed187eb2639a4d5662c31279 to your computer and use it in GitHub Desktop.
Save andredublin/d2df0826ed187eb2639a4d5662c31279 to your computer and use it in GitHub Desktop.
module FableD3
open Fable.Core
open Fable.Core.JsInterop
open Fable.Import
open Fable.Import.Browser
let chart() =
let data = [| 30; 86; 168; 201; 303; 365 |]
D3.Globals.select("chart")
.selectAll("div")
.data(data)
|> fun x -> (unbox<D3.Selection.Update<int>> x).enter()
|> fun x -> x.append("div")
|> fun x -> (unbox<D3.Selection.Update<HTMLDivElementType>> x).style("width", fun _ b _ -> U3.Case2(b.ToString() + "px"))
|> fun x -> (unbox<D3.Selection.Update<HTMLDivElementType>> x).text()
chart() |> ignore
ERROR in ./src/App.fs
Module not found: Error: Can't resolve 'd3' in 'D:\FableD3\src'
@ ./src/App.fs 2:0-25
@ ./src/FableD3.fsproj
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src/FableD3.fsproj
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\paket-files\fable-compiler\fable-graphics\bindings\fable-import-d3\Fable.Import.D3.fs">
<Paket>True</Paket>
<Link>paket-files/Fable.Import.D3.fs</Link>
</Compile>
<Compile Include="App.fs" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment