Skip to content

Commit f53ee84

Browse files
Publish Fable.Recharts 0.1.0-beta-002
1 parent 38f1f3b commit f53ee84

File tree

16 files changed

+5421
-594
lines changed

16 files changed

+5421
-594
lines changed

.paket/Paket.Restore.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@
114114
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
115115
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
116116
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
117+
<AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
117118
</PaketReferencesFileLinesInfo>
118119
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
119120
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
121+
<PrivateAssets Condition="%(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'true'">All</PrivateAssets>
120122
</PackageReference>
121123
</ItemGroup>
122124

paket.dependencies

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
source https://www.nuget.org/api/v2
22
storage: none
33

4+
clitool dotnet-Fable
45
nuget Fable.Core
56
nuget Fable.Import.Browser
67

paket.lock

Lines changed: 680 additions & 536 deletions
Large diffs are not rendered by default.

src/Fable.React/Fable.Helpers.React.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ module Props =
115115
| ClassID of string
116116
| ClassName of string
117117
/// Alias of ClassName
118-
| [<CompiledName("ClassName")>] Class of string
118+
| [<CompiledName("className")>] Class of string
119119
| Cols of float
120120
| ColSpan of float
121121
| Content of string

src/Fable.Recharts.Sample/App.fs

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
module App
2+
3+
open Fable.Recharts
4+
open Fable.Recharts.Props
5+
module R = Fable.Helpers.React
6+
module P = R.Props
7+
open Data
8+
9+
let margin t r b l =
10+
Chart.Margin { top = t; bottom = b; right = r; left = l }
11+
12+
let lineChartSample() =
13+
lineChart
14+
[ margin 5. 20. 5. 0.
15+
Chart.Width 600.
16+
Chart.Height 300.
17+
Chart.Data data ]
18+
[ line
19+
[ Cartesian.Type Monotone
20+
Cartesian.DataKey "uv"
21+
P.Stroke "#8884d8"
22+
P.StrokeWidth 2. ]
23+
[]
24+
cartesianGrid
25+
[ P.Stroke "#ccc"
26+
P.StrokeDasharray "5 5" ]
27+
[]
28+
xaxis [Cartesian.DataKey "name"] []
29+
yaxis [] []
30+
tooltip [] []
31+
]
32+
33+
let barChartSample() =
34+
barChart
35+
[ margin 5. 20. 5. 0.
36+
Chart.Width 600.
37+
Chart.Height 300.
38+
Chart.Data data ]
39+
[ xaxis [Cartesian.DataKey "name"] []
40+
yaxis [] []
41+
tooltip [] []
42+
legend [] []
43+
cartesianGrid [P.StrokeDasharray "3 3"] []
44+
bar [Cartesian.DataKey "pv"; Cartesian.StackId "a"; P.Fill "#8884d8"] []
45+
bar [Cartesian.DataKey "uv"; Cartesian.StackId "a"; P.Fill "#82ca9d"] []
46+
]
47+
48+
let areaChartSample() =
49+
areaChart
50+
[ margin 10. 30. 0. 0.
51+
Chart.Width 730.
52+
Chart.Height 250.
53+
Chart.Data data ]
54+
[
55+
R.defs []
56+
[ R.linearGradient
57+
[ P.Id "colorUv"; P.X1 0.; P.Y1 0.; P.X2 0.; P.Y2 1.]
58+
[ R.stop [ P.Offset "5%"; P.StopColor "#8884d8"; P.StopOpacity 0.8 ] []
59+
R.stop [ P.Offset "95%"; P.StopColor "#8884d8"; P.StopOpacity 0 ] [] ]
60+
R.linearGradient
61+
[ P.Id "colorPv"; P.X1 0.; P.Y1 0.; P.X2 0.; P.Y2 1.]
62+
[ R.stop [ P.Offset "5%"; P.StopColor "#82ca9d"; P.StopOpacity 0.8 ] []
63+
R.stop [ P.Offset "95%"; P.StopColor "#82ca9d"; P.StopOpacity 0 ] [] ] ]
64+
xaxis [ Cartesian.DataKey "name" ] []
65+
yaxis [] []
66+
cartesianGrid [P.StrokeDasharray "3 3"] []
67+
tooltip [] []
68+
area
69+
[ Cartesian.Type Monotone
70+
Cartesian.DataKey "uv"
71+
Cartesian.Stroke "#8884d8"
72+
P.Fill "url(#colorUv)"
73+
P.FillOpacity 1 ] []
74+
area
75+
[ Cartesian.Type Monotone
76+
Cartesian.DataKey "pv"
77+
Cartesian.Stroke "#82ca9d"
78+
P.Fill "url(#colorPv)"
79+
P.FillOpacity 1 ] []
80+
]
81+
82+
let renderApp() =
83+
R.mountById "container1" <| lineChartSample()
84+
R.mountById "container2" <| barChartSample()
85+
R.mountById "container3" <| areaChartSample()
86+
87+
renderApp()

src/Fable.Recharts.Sample/Data.fs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
module Data
2+
3+
open Fable.Core
4+
5+
type [<Pojo>] Data =
6+
{ name: string; uv: int; pv: int; amt: int }
7+
8+
type [<Pojo>] Data01 =
9+
{ day: string; weather: string }
10+
11+
type [<Pojo>] RangeData =
12+
{ day: string; temperature: int * int }
13+
14+
let data =
15+
[| { name = "Page A"; uv = 4000; pv = 2400; amt = 2400 }
16+
{ name = "Page B"; uv = 3000; pv = 1398; amt = 2210 }
17+
{ name = "Page C"; uv = 2000; pv = 9800; amt = 2290 }
18+
{ name = "Page D"; uv = 2780; pv = 3908; amt = 2000 }
19+
{ name = "Page E"; uv = 1890; pv = 4800; amt = 2181 }
20+
{ name = "Page F"; uv = 2390; pv = 3800; amt = 2500 }
21+
{ name = "Page G"; uv = 3490; pv = 4300; amt = 2100 }
22+
|]
23+
24+
let data01 =
25+
[| { day = "05-01"; weather = "sunny" }
26+
{ day = "05-02"; weather = "sunny" }
27+
{ day = "05-03"; weather = "cloudy" }
28+
{ day = "05-04"; weather = "rain" }
29+
{ day = "05-05"; weather = "rain" }
30+
{ day = "05-06"; weather = "cloudy" }
31+
{ day = "05-07"; weather = "cloudy" }
32+
{ day = "05-08"; weather = "sunny" }
33+
{ day = "05-09"; weather = "sunny" }
34+
|]
35+
36+
let data02 =
37+
[| { name = "Page A"; uv = 4000; pv = 2400; amt = 2400 }
38+
{ name = "Page B"; uv = 3000; pv = 1398; amt = 2210 }
39+
{ name = "Page C"; uv = 2000; pv = 9800; amt = 2290 }
40+
{ name = "Page D"; uv = 2780; pv = 3908; amt = 2000 }
41+
{ name = "Page E"; uv = 1890; pv = 4800; amt = 2181 }
42+
|]
43+
44+
let rangeData =
45+
[| { day = "05-01"; temperature = (-1, 10) }
46+
{ day = "05-02"; temperature = (2, 15) }
47+
{ day = "05-03"; temperature = (3, 12) }
48+
{ day = "05-04"; temperature = (4, 12) }
49+
{ day = "05-05"; temperature = (12, 16) }
50+
{ day = "05-06"; temperature = (5, 16) }
51+
{ day = "05-07"; temperature = (3, 12) }
52+
{ day = "05-08"; temperature = (0, 8) }
53+
{ day = "05-09"; temperature = (-3, 5) }
54+
|]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk">
3+
<PropertyGroup>
4+
<Version>0.1.0-beta-001</Version>
5+
<TargetFramework>netstandard1.6</TargetFramework>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<Compile Include="../Fable.Recharts/Fable.Recharts.fs" />
9+
<Compile Include="Data.fs" />
10+
<Compile Include="App.fs" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<ProjectReference Include="../Fable.React/Fable.React.fsproj" />
14+
</ItemGroup>
15+
<Import Project="..\..\.paket\Paket.Restore.targets" />
16+
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Fable.Recharts.Sample
2+
3+
Run `yarn` and then `yarn start` in this directory to test the demo.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>Fable + Recharts</title>
5+
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
</head>
8+
<body>
9+
<h1>Fable + Recharts</h1>
10+
<div id="container1"></div>
11+
<div id="container2"></div>
12+
<div id="container3"></div>
13+
<div id="container4"></div>
14+
<div id="container5"></div>
15+
<div id="container6"></div>
16+
<script src="bundle.js"></script>
17+
</body>
18+
</html>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"postinstall": "dotnet restore",
5+
"start": "dotnet fable webpack-dev-server"
6+
},
7+
"dependencies": {
8+
"react": "^16.2.0",
9+
"react-dom": "^16.2.0",
10+
"recharts": "^1.0.0-beta.7"
11+
},
12+
"devDependencies": {
13+
"babel-core": "^6.26.0",
14+
"babel-loader": "^7.1.2",
15+
"babel-preset-env": "^1.6.1",
16+
"fable-loader": "^1.1.6",
17+
"fable-utils": "^1.0.6",
18+
"webpack": "^3.10.0",
19+
"webpack-dev-server": "^2.9.7"
20+
}
21+
}

0 commit comments

Comments
 (0)