Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-reactix-d3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-reactix-d3
Commits
0ee1f55e
Commit
0ee1f55e
authored
Jun 21, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[example] xml works
parent
411bbf77
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
219 additions
and
57 deletions
+219
-57
index.html
example/dist/index.html
+1
-0
index.html
example/index.html
+1
-0
index.js
example/index.js
+134
-36
packages.dhall
example/packages.dhall
+1
-1
spago.dhall
example/spago.dhall
+1
-0
Main.purs
example/src/Main.purs
+24
-10
employees.xml
example/static/data/employees.xml
+11
-0
static_serve.js
example/static_serve.js
+19
-0
yarn.lock
example/yarn.lock
+24
-8
packages-additions.dhall
packages-additions.dhall
+3
-2
No files found.
example/dist/index.html
View file @
0ee1f55e
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
<div
id=
"time-axis"
></div>
<div
id=
"time-axis"
></div>
<div
id=
"links"
></div>
<div
id=
"links"
></div>
<div
id=
"reset-zoom"
>
Reset zoom
</div>
<div
id=
"reset-zoom"
>
Reset zoom
</div>
<div
id=
"xml"
></div>
<!-- NOTE: it's important that this is at the end so that the DOM is ready -->
<!-- NOTE: it's important that this is at the end so that the DOM is ready -->
<script
type=
"text/javascript"
src=
"/index.fd532818.js"
></script>
<script
type=
"text/javascript"
src=
"/index.fd532818.js"
></script>
...
...
example/index.html
View file @
0ee1f55e
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
<div
id=
"time-axis"
></div>
<div
id=
"time-axis"
></div>
<div
id=
"links"
></div>
<div
id=
"links"
></div>
<div
id=
"reset-zoom"
>
Reset zoom
</div>
<div
id=
"reset-zoom"
>
Reset zoom
</div>
<div
id=
"xml"
></div>
<!-- NOTE: it's important that this is at the end so that the DOM is ready -->
<!-- NOTE: it's important that this is at the end so that the DOM is ready -->
<script
type=
"text/javascript"
src=
"index.js"
></script>
<script
type=
"text/javascript"
src=
"index.js"
></script>
...
...
example/index.js
View file @
0ee1f55e
...
@@ -2549,6 +2549,11 @@ var PS = {};
...
@@ -2549,6 +2549,11 @@ var PS = {};
var
FFI_Simple_Functions
=
$PS
[
"FFI.Simple.Functions"
];
var
FFI_Simple_Functions
=
$PS
[
"FFI.Simple.Functions"
];
var
FFI_Simple_Globals
=
$PS
[
"FFI.Simple.Globals"
];
var
FFI_Simple_Globals
=
$PS
[
"FFI.Simple.Globals"
];
var
console
=
FFI_Simple_Globals
.
unsafeGlobal
(
"console"
);
var
console
=
FFI_Simple_Globals
.
unsafeGlobal
(
"console"
);
var
log
=
function
(
a
)
{
return
FFI_Simple_Functions
.
delay
(
FFI_Simple_Functions
.
delayMonad
(
Effect
.
monadEffect
))(
Data_Unit
.
unit
)(
function
(
v
)
{
return
Control_Applicative
.
pure
(
Effect
.
applicativeEffect
)(
FFI_Simple_Functions
[
"applyMethod'"
](
console
)(
"log"
)([
a
]));
});
};
var
log2
=
function
(
a
)
{
var
log2
=
function
(
a
)
{
return
function
(
b
)
{
return
function
(
b
)
{
return
FFI_Simple_Functions
.
delay
(
FFI_Simple_Functions
.
delayMonad
(
Effect
.
monadEffect
))(
Data_Unit
.
unit
)(
function
(
v
)
{
return
FFI_Simple_Functions
.
delay
(
FFI_Simple_Functions
.
delayMonad
(
Effect
.
monadEffect
))(
Data_Unit
.
unit
)(
function
(
v
)
{
...
@@ -2556,6 +2561,7 @@ var PS = {};
...
@@ -2556,6 +2561,7 @@ var PS = {};
});
});
};
};
};
};
exports
[
"log"
]
=
log
;
exports
[
"log2"
]
=
log2
;
exports
[
"log2"
]
=
log2
;
})(
PS
);
})(
PS
);
(
function
(
exports
)
{
(
function
(
exports
)
{
...
@@ -2820,6 +2826,16 @@ var PS = {};
...
@@ -2820,6 +2826,16 @@ var PS = {};
(
function
(
exports
)
{
(
function
(
exports
)
{
"use strict"
;
"use strict"
;
exports
.
runEffectFn2
=
function
runEffectFn2
(
fn
)
{
return
function
(
a
)
{
return
function
(
b
)
{
return
function
()
{
return
fn
(
a
,
b
);
};
};
};
};
exports
.
runEffectFn3
=
function
runEffectFn3
(
fn
)
{
exports
.
runEffectFn3
=
function
runEffectFn3
(
fn
)
{
return
function
(
a
)
{
return
function
(
a
)
{
return
function
(
b
)
{
return
function
(
b
)
{
...
@@ -2838,23 +2854,9 @@ var PS = {};
...
@@ -2838,23 +2854,9 @@ var PS = {};
$PS
[
"Effect.Uncurried"
]
=
$PS
[
"Effect.Uncurried"
]
||
{};
$PS
[
"Effect.Uncurried"
]
=
$PS
[
"Effect.Uncurried"
]
||
{};
var
exports
=
$PS
[
"Effect.Uncurried"
];
var
exports
=
$PS
[
"Effect.Uncurried"
];
var
$foreign
=
$PS
[
"Effect.Uncurried"
];
var
$foreign
=
$PS
[
"Effect.Uncurried"
];
exports
[
"runEffectFn2"
]
=
$foreign
.
runEffectFn2
;
exports
[
"runEffectFn3"
]
=
$foreign
.
runEffectFn3
;
exports
[
"runEffectFn3"
]
=
$foreign
.
runEffectFn3
;
})(
PS
);
})(
PS
);
(
function
(
exports
)
{
"use strict"
;
exports
.
unsafePerformEffect
=
function
(
f
)
{
return
f
();
};
})(
PS
[
"Effect.Unsafe"
]
=
PS
[
"Effect.Unsafe"
]
||
{});
(
function
(
$PS
)
{
// Generated by purs version 0.14.2
"use strict"
;
$PS
[
"Effect.Unsafe"
]
=
$PS
[
"Effect.Unsafe"
]
||
{};
var
exports
=
$PS
[
"Effect.Unsafe"
];
var
$foreign
=
$PS
[
"Effect.Unsafe"
];
exports
[
"unsafePerformEffect"
]
=
$foreign
.
unsafePerformEffect
;
})(
PS
);
(
function
(
exports
)
{
(
function
(
exports
)
{
'use strict'
;
'use strict'
;
var
d3
=
require
(
"d3/dist/d3.js"
);
var
d3
=
require
(
"d3/dist/d3.js"
);
...
@@ -3002,6 +3004,10 @@ var PS = {};
...
@@ -3002,6 +3004,10 @@ var PS = {};
return
handle
(
row
);
return
handle
(
row
);
});
});
};
};
exports
.
xmlImpl
=
function
(
d3
,
url
)
{
return
d3
.
xml
(
url
);
};
})(
PS
[
"Graphics.D3.Request"
]
=
PS
[
"Graphics.D3.Request"
]
||
{});
})(
PS
[
"Graphics.D3.Request"
]
=
PS
[
"Graphics.D3.Request"
]
||
{});
(
function
(
$PS
)
{
(
function
(
$PS
)
{
// Generated by purs version 0.14.2
// Generated by purs version 0.14.2
...
@@ -3011,6 +3017,11 @@ var PS = {};
...
@@ -3011,6 +3017,11 @@ var PS = {};
var
$foreign
=
$PS
[
"Graphics.D3.Request"
];
var
$foreign
=
$PS
[
"Graphics.D3.Request"
];
var
Control_Promise
=
$PS
[
"Control.Promise"
];
var
Control_Promise
=
$PS
[
"Control.Promise"
];
var
Graphics_D3_Base
=
$PS
[
"Graphics.D3.Base"
];
var
Graphics_D3_Base
=
$PS
[
"Graphics.D3.Base"
];
var
xml
=
function
(
url
)
{
return
Control_Promise
.
toAffE
(
function
()
{
return
$foreign
.
xmlImpl
(
Graphics_D3_Base
.
d3
,
url
);
});
};
var
csv
=
function
(
url
)
{
var
csv
=
function
(
url
)
{
return
function
(
handle
)
{
return
function
(
handle
)
{
return
Control_Promise
.
toAffE
(
function
()
{
return
Control_Promise
.
toAffE
(
function
()
{
...
@@ -3019,6 +3030,7 @@ var PS = {};
...
@@ -3019,6 +3030,7 @@ var PS = {};
};
};
};
};
exports
[
"csv"
]
=
csv
;
exports
[
"csv"
]
=
csv
;
exports
[
"xml"
]
=
xml
;
})(
PS
);
})(
PS
);
(
function
(
$PS
)
{
(
function
(
$PS
)
{
// Generated by purs version 0.14.2
// Generated by purs version 0.14.2
...
@@ -3101,9 +3113,16 @@ var PS = {};
...
@@ -3101,9 +3113,16 @@ var PS = {};
var
Joinable
=
function
(
join
)
{
var
Joinable
=
function
(
join
)
{
this
.
join
=
join
;
this
.
join
=
join
;
};
};
var
Clickable
=
function
(
onClick
,
onDoubleClick
)
{
this
.
onClick
=
onClick
;
this
.
onDoubleClick
=
onDoubleClick
;
};
var
Classed
=
function
(
classed
)
{
var
Classed
=
function
(
classed
)
{
this
.
classed
=
classed
;
this
.
classed
=
classed
;
};
};
var
Callable
=
function
(
call
)
{
this
.
call
=
call
;
};
var
Existing
=
function
(
attr
,
attr$prime
,
attr$prime$prime
,
remove
,
style
,
style$prime
,
style$prime$prime
,
text
,
text$prime
,
text$prime$prime
)
{
var
Existing
=
function
(
attr
,
attr$prime
,
attr$prime$prime
,
remove
,
style
,
style$prime
,
style$prime$prime
,
text
,
text$prime
,
text$prime$prime
)
{
this
.
attr
=
attr
;
this
.
attr
=
attr
;
this
[
"attr'"
]
=
attr$prime
;
this
[
"attr'"
]
=
attr$prime
;
...
@@ -3128,6 +3147,7 @@ var PS = {};
...
@@ -3128,6 +3147,7 @@ var PS = {};
var
unsafeRemove
=
Graphics_D3_Util
.
ffi
([
"selection"
,
""
])(
"selection.remove()"
);
var
unsafeRemove
=
Graphics_D3_Util
.
ffi
([
"selection"
,
""
])(
"selection.remove()"
);
var
unsafeJoin
=
Graphics_D3_Util
.
ffi
([
"tag"
,
"selection"
,
""
])(
"selection.join(tag)"
);
var
unsafeJoin
=
Graphics_D3_Util
.
ffi
([
"tag"
,
"selection"
,
""
])(
"selection.join(tag)"
);
var
unsafeClassed
=
Graphics_D3_Util
.
ffi
([
"tag"
,
"value"
,
"selection"
,
""
])(
"selection.classed(tag, value)"
);
var
unsafeClassed
=
Graphics_D3_Util
.
ffi
([
"tag"
,
"value"
,
"selection"
,
""
])(
"selection.classed(tag, value)"
);
var
unsafeCall
=
Graphics_D3_Util
.
ffi
([
"what"
,
"func"
,
"selection"
,
""
])(
"selection.call(what, func)"
);
var
unsafeAttr$prime$prime
=
function
(
dictAttrValue
)
{
var
unsafeAttr$prime$prime
=
function
(
dictAttrValue
)
{
return
Graphics_D3_Util
.
ffi
([
"key"
,
"val"
,
"selection"
,
""
])(
"selection.attr(key, function (d, i) { return val(d)(i); })"
);
return
Graphics_D3_Util
.
ffi
([
"key"
,
"val"
,
"selection"
,
""
])(
"selection.attr(key, function (d, i) { return val(d)(i); })"
);
};
};
...
@@ -3146,6 +3166,9 @@ var PS = {};
...
@@ -3146,6 +3166,9 @@ var PS = {};
};
};
var
selectAll
=
Graphics_D3_Util
.
ffi
([
"selector"
,
"selection"
,
""
])(
"selection.selectAll(selector)"
);
var
selectAll
=
Graphics_D3_Util
.
ffi
([
"selector"
,
"selection"
,
""
])(
"selection.selectAll(selector)"
);
var
rootSelect
=
Graphics_D3_Util
.
ffiD3
([
"selector"
,
""
])(
"d3.select(selector)"
);
var
rootSelect
=
Graphics_D3_Util
.
ffiD3
([
"selector"
,
""
])(
"d3.select(selector)"
);
var
onClick
=
function
(
dict
)
{
return
dict
.
onClick
;
};
var
joinableUpdate
=
new
Joinable
(
unsafeJoin
);
var
joinableUpdate
=
new
Joinable
(
unsafeJoin
);
var
join
=
function
(
dict
)
{
var
join
=
function
(
dict
)
{
return
dict
.
join
;
return
dict
.
join
;
...
@@ -3165,10 +3188,15 @@ var PS = {};
...
@@ -3165,10 +3188,15 @@ var PS = {};
return
unsafeAttr$prime$prime
();
return
unsafeAttr$prime$prime
();
},
unsafeRemove
,
unsafeStyle
,
unsafeStyle$prime
,
unsafeStyle$prime$prime
,
unsafeText
,
unsafeText$prime
,
unsafeText$prime$prime
);
},
unsafeRemove
,
unsafeStyle
,
unsafeStyle$prime
,
unsafeStyle$prime$prime
,
unsafeText
,
unsafeText$prime
,
unsafeText$prime$prime
);
var
enter
=
Graphics_D3_Util
.
ffi
([
"update"
,
""
])(
"update.enter()"
);
var
enter
=
Graphics_D3_Util
.
ffi
([
"update"
,
""
])(
"update.enter()"
);
var
clickableSelection
=
new
Clickable
(
Graphics_D3_Util
.
ffi
([
"callback"
,
"clickable"
,
""
])(
"clickable.on('click', function(data) { callback(data)(); })"
),
Graphics_D3_Util
.
ffi
([
"callback"
,
"clickable"
,
""
])(
"clickable.on('dblclick', function (data) { callback(data)(); })"
));
var
classedSelection
=
new
Classed
(
unsafeClassed
);
var
classedSelection
=
new
Classed
(
unsafeClassed
);
var
classed
=
function
(
dict
)
{
var
classed
=
function
(
dict
)
{
return
dict
.
classed
;
return
dict
.
classed
;
};
};
var
callableSelection
=
new
Callable
(
unsafeCall
);
var
call
=
function
(
dict
)
{
return
dict
.
call
;
};
var
bindData
=
Graphics_D3_Util
.
ffi
([
"array"
,
"selection"
,
""
])(
"selection.data(array)"
);
var
bindData
=
Graphics_D3_Util
.
ffi
([
"array"
,
"selection"
,
""
])(
"selection.data(array)"
);
var
attr$prime
=
function
(
dict
)
{
var
attr$prime
=
function
(
dict
)
{
return
dict
[
"attr'"
];
return
dict
[
"attr'"
];
...
@@ -3210,6 +3238,7 @@ var PS = {};
...
@@ -3210,6 +3238,7 @@ var PS = {};
exports
[
"selectAll"
]
=
selectAll
;
exports
[
"selectAll"
]
=
selectAll
;
exports
[
"bindData"
]
=
bindData
;
exports
[
"bindData"
]
=
bindData
;
exports
[
"enter"
]
=
enter
;
exports
[
"enter"
]
=
enter
;
exports
[
"call"
]
=
call
;
exports
[
"append"
]
=
append
;
exports
[
"append"
]
=
append
;
exports
[
"combineAppend"
]
=
combineAppend
;
exports
[
"combineAppend"
]
=
combineAppend
;
exports
[
"join"
]
=
join
;
exports
[
"join"
]
=
join
;
...
@@ -3219,12 +3248,15 @@ var PS = {};
...
@@ -3219,12 +3248,15 @@ var PS = {};
exports
[
"combineAttr'"
]
=
combineAttr$prime
;
exports
[
"combineAttr'"
]
=
combineAttr$prime
;
exports
[
"style''"
]
=
style$prime$prime
;
exports
[
"style''"
]
=
style$prime$prime
;
exports
[
"text'"
]
=
text$prime
;
exports
[
"text'"
]
=
text$prime
;
exports
[
"onClick"
]
=
onClick
;
exports
[
"callableSelection"
]
=
callableSelection
;
exports
[
"appendableSelection"
]
=
appendableSelection
;
exports
[
"appendableSelection"
]
=
appendableSelection
;
exports
[
"appendableEnter"
]
=
appendableEnter
;
exports
[
"appendableEnter"
]
=
appendableEnter
;
exports
[
"joinableUpdate"
]
=
joinableUpdate
;
exports
[
"joinableUpdate"
]
=
joinableUpdate
;
exports
[
"classedSelection"
]
=
classedSelection
;
exports
[
"classedSelection"
]
=
classedSelection
;
exports
[
"existingSelection"
]
=
existingSelection
;
exports
[
"existingSelection"
]
=
existingSelection
;
exports
[
"existingUpdate"
]
=
existingUpdate
;
exports
[
"existingUpdate"
]
=
existingUpdate
;
exports
[
"clickableSelection"
]
=
clickableSelection
;
})(
PS
);
})(
PS
);
(
function
(
exports
)
{
(
function
(
exports
)
{
/* global exports */
/* global exports */
...
@@ -3251,7 +3283,11 @@ var PS = {};
...
@@ -3251,7 +3283,11 @@ var PS = {};
(
function
(
exports
)
{
(
function
(
exports
)
{
'use strict'
;
'use strict'
;
exports
.
zoomImpl
=
function
(
d3
)
{
return
d3
.
zoom
();
};
exports
.
onImpl
=
function
(
key
,
func
,
z
)
{
return
z
.
on
(
key
,
func
);
};
exports
.
onImpl
=
function
(
key
,
func
,
z
)
{
return
z
.
on
(
key
,
func
);
};
exports
.
renderZoomImpl
=
function
(
zoom
,
selection
)
{
return
selection
.
call
(
zoom
);
};
})(
PS
[
"Graphics.D3.Zoom"
]
=
PS
[
"Graphics.D3.Zoom"
]
||
{});
})(
PS
[
"Graphics.D3.Zoom"
]
=
PS
[
"Graphics.D3.Zoom"
]
||
{});
(
function
(
$PS
)
{
(
function
(
$PS
)
{
// Generated by purs version 0.14.2
// Generated by purs version 0.14.2
...
@@ -3260,25 +3296,32 @@ var PS = {};
...
@@ -3260,25 +3296,32 @@ var PS = {};
var
exports
=
$PS
[
"Graphics.D3.Zoom"
];
var
exports
=
$PS
[
"Graphics.D3.Zoom"
];
var
$foreign
=
$PS
[
"Graphics.D3.Zoom"
];
var
$foreign
=
$PS
[
"Graphics.D3.Zoom"
];
var
Effect_Uncurried
=
$PS
[
"Effect.Uncurried"
];
var
Effect_Uncurried
=
$PS
[
"Effect.Uncurried"
];
var
Graphics_D3_Base
=
$PS
[
"Graphics.D3.Base"
];
var
Graphics_D3_Util
=
$PS
[
"Graphics.D3.Util"
];
var
Graphics_D3_Util
=
$PS
[
"Graphics.D3.Util"
];
var
Transformable
=
function
(
transform
)
{
var
Transformable
=
function
(
transform
)
{
this
.
transform
=
transform
;
this
.
transform
=
transform
;
};
};
var
zoom
=
Graphics_D3_Util
.
ffiD3
([
""
])(
"d3.zoom()"
);
var
zoomIdentity
=
Graphics_D3_Util
.
ffiD3
([
""
])(
"d3.zoomIdentity"
);
var
zoom
=
function
()
{
return
$foreign
.
zoomImpl
(
Graphics_D3_Base
.
d3
);
};
var
unsafeTransform
=
Graphics_D3_Util
.
ffi
([
"obj"
])(
"obj.transform"
);
var
unsafeTransform
=
Graphics_D3_Util
.
ffi
([
"obj"
])(
"obj.transform"
);
var
transform
=
function
(
dict
)
{
var
transform
=
function
(
dict
)
{
return
dict
.
transform
;
return
dict
.
transform
;
};
};
var
renderZoom
=
function
(
dictExisting
)
{
var
renderZoom
=
function
(
dictExisting
)
{
return
Graphics_D3_Util
.
ffi
([
"zoom"
,
"selection"
,
""
])(
"selection.call(zoom)"
);
return
Effect_Uncurried
.
runEffectFn2
(
$foreign
.
renderZoomImpl
);
};
};
var
on
=
Effect_Uncurried
.
runEffectFn3
(
$foreign
.
onImpl
);
var
on
=
Effect_Uncurried
.
runEffectFn3
(
$foreign
.
onImpl
);
var
$dollar_TransformableZoom_1
=
new
Transformable
(
unsafeTransform
);
var
$dollar_TransformableZoomE_0
=
new
Transformable
(
unsafeTransform
);
var
$dollar_TransformableZoomE_0
=
new
Transformable
(
unsafeTransform
);
exports
[
"transform"
]
=
transform
;
exports
[
"transform"
]
=
transform
;
exports
[
"zoom"
]
=
zoom
;
exports
[
"zoom"
]
=
zoom
;
exports
[
"zoomIdentity"
]
=
zoomIdentity
;
exports
[
"on"
]
=
on
;
exports
[
"on"
]
=
on
;
exports
[
"renderZoom"
]
=
renderZoom
;
exports
[
"renderZoom"
]
=
renderZoom
;
exports
[
"$_TransformableZoomE_0"
]
=
$dollar_TransformableZoomE_0
;
exports
[
"$_TransformableZoomE_0"
]
=
$dollar_TransformableZoomE_0
;
exports
[
"$_TransformableZoom_1"
]
=
$dollar_TransformableZoom_1
;
})(
PS
);
})(
PS
);
(
function
(
exports
)
{
(
function
(
exports
)
{
"use strict"
;
"use strict"
;
...
@@ -3317,6 +3360,42 @@ var PS = {};
...
@@ -3317,6 +3360,42 @@ var PS = {};
var
$foreign
=
$PS
[
"Math"
];
var
$foreign
=
$PS
[
"Math"
];
exports
[
"remainder"
]
=
$foreign
.
remainder
;
exports
[
"remainder"
]
=
$foreign
.
remainder
;
})(
PS
);
})(
PS
);
(
function
(
exports
)
{
"use strict"
;
exports
.
getElementsByTagName
=
function
(
localName
)
{
return
function
(
doc
)
{
return
function
()
{
return
doc
.
getElementsByTagName
(
localName
);
};
};
};
})(
PS
[
"Web.DOM.Document"
]
=
PS
[
"Web.DOM.Document"
]
||
{});
(
function
(
$PS
)
{
// Generated by purs version 0.14.2
"use strict"
;
$PS
[
"Web.DOM.Document"
]
=
$PS
[
"Web.DOM.Document"
]
||
{};
var
exports
=
$PS
[
"Web.DOM.Document"
];
var
$foreign
=
$PS
[
"Web.DOM.Document"
];
exports
[
"getElementsByTagName"
]
=
$foreign
.
getElementsByTagName
;
})(
PS
);
(
function
(
exports
)
{
"use strict"
;
exports
.
toArray
=
function
(
list
)
{
return
function
()
{
return
[].
slice
.
call
(
list
);
};
};
})(
PS
[
"Web.DOM.HTMLCollection"
]
=
PS
[
"Web.DOM.HTMLCollection"
]
||
{});
(
function
(
$PS
)
{
// Generated by purs version 0.14.2
"use strict"
;
$PS
[
"Web.DOM.HTMLCollection"
]
=
$PS
[
"Web.DOM.HTMLCollection"
]
||
{};
var
exports
=
$PS
[
"Web.DOM.HTMLCollection"
];
var
$foreign
=
$PS
[
"Web.DOM.HTMLCollection"
];
exports
[
"toArray"
]
=
$foreign
.
toArray
;
})(
PS
);
(
function
(
$PS
)
{
(
function
(
$PS
)
{
// Generated by purs version 0.14.2
// Generated by purs version 0.14.2
"use strict"
;
"use strict"
;
...
@@ -3339,7 +3418,6 @@ var PS = {};
...
@@ -3339,7 +3418,6 @@ var PS = {};
var
Effect
=
$PS
[
"Effect"
];
var
Effect
=
$PS
[
"Effect"
];
var
Effect_Aff
=
$PS
[
"Effect.Aff"
];
var
Effect_Aff
=
$PS
[
"Effect.Aff"
];
var
Effect_Class
=
$PS
[
"Effect.Class"
];
var
Effect_Class
=
$PS
[
"Effect.Class"
];
var
Effect_Unsafe
=
$PS
[
"Effect.Unsafe"
];
var
Foreign
=
$PS
[
"Foreign"
];
var
Foreign
=
$PS
[
"Foreign"
];
var
Graphics_D3_Base
=
$PS
[
"Graphics.D3.Base"
];
var
Graphics_D3_Base
=
$PS
[
"Graphics.D3.Base"
];
var
Graphics_D3_Contour
=
$PS
[
"Graphics.D3.Contour"
];
var
Graphics_D3_Contour
=
$PS
[
"Graphics.D3.Contour"
];
...
@@ -3351,6 +3429,8 @@ var PS = {};
...
@@ -3351,6 +3429,8 @@ var PS = {};
var
Graphics_D3_Time
=
$PS
[
"Graphics.D3.Time"
];
var
Graphics_D3_Time
=
$PS
[
"Graphics.D3.Time"
];
var
Graphics_D3_Zoom
=
$PS
[
"Graphics.D3.Zoom"
];
var
Graphics_D3_Zoom
=
$PS
[
"Graphics.D3.Zoom"
];
var
$$Math
=
$PS
[
"Math"
];
var
$$Math
=
$PS
[
"Math"
];
var
Web_DOM_Document
=
$PS
[
"Web.DOM.Document"
];
var
Web_DOM_HTMLCollection
=
$PS
[
"Web.DOM.HTMLCollection"
];
var
main
=
function
__do
()
{
var
main
=
function
__do
()
{
DOM_Simple_Console
.
log2
(
"d3"
)(
Graphics_D3_Base
.
d3
)();
DOM_Simple_Console
.
log2
(
"d3"
)(
Graphics_D3_Base
.
d3
)();
var
scale
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Scale
.
linearScale
)(
Graphics_D3_Scale
.
domain
(
Graphics_D3_Scale
.
scaleLinear
)([
-
10.0
,
10.0
])))(
Graphics_D3_Scale
.
range
(
Graphics_D3_Scale
.
scaleLinear
)([
0.0
,
1.0
])))(
Graphics_D3_Scale
.
toFunction
(
Graphics_D3_Scale
.
scaleLinear
))();
var
scale
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Scale
.
linearScale
)(
Graphics_D3_Scale
.
domain
(
Graphics_D3_Scale
.
scaleLinear
)([
-
10.0
,
10.0
])))(
Graphics_D3_Scale
.
range
(
Graphics_D3_Scale
.
scaleLinear
)([
0.0
,
1.0
])))(
Graphics_D3_Scale
.
toFunction
(
Graphics_D3_Scale
.
scaleLinear
))();
...
@@ -3363,8 +3443,8 @@ var PS = {};
...
@@ -3363,8 +3443,8 @@ var PS = {};
DOM_Simple_Console
.
log2
(
"simpleData"
)(
simpleData
)();
DOM_Simple_Console
.
log2
(
"simpleData"
)(
simpleData
)();
var
dataWithAppend
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableEnter
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Selection
.
rootSelect
(
"#data-with-append"
))(
Graphics_D3_Selection
.
selectAll
(
"p"
)))(
Graphics_D3_Selection
.
bindData
(
data$prime
)))(
Graphics_D3_Selection
.
enter
))(
"p"
))(
Graphics_D3_Selection
[
"style''"
](
Graphics_D3_Selection
.
existingSelection
)(
"color"
)(
function
(
d
)
{
var
dataWithAppend
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableEnter
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Selection
.
rootSelect
(
"#data-with-append"
))(
Graphics_D3_Selection
.
selectAll
(
"p"
)))(
Graphics_D3_Selection
.
bindData
(
data$prime
)))(
Graphics_D3_Selection
.
enter
))(
"p"
))(
Graphics_D3_Selection
[
"style''"
](
Graphics_D3_Selection
.
existingSelection
)(
"color"
)(
function
(
d
)
{
return
function
(
idx
)
{
return
function
(
idx
)
{
var
$1
0
=
$$Math
.
remainder
(
idx
)(
2.0
)
===
0.0
;
var
$1
1
=
$$Math
.
remainder
(
idx
)(
2.0
)
===
0.0
;
if
(
$1
0
)
{
if
(
$1
1
)
{
return
"green"
;
return
"green"
;
};
};
return
"red"
;
return
"red"
;
...
@@ -3379,7 +3459,7 @@ var PS = {};
...
@@ -3379,7 +3459,7 @@ var PS = {};
};
};
var
width
=
(
460
-
margin
.
left
|
0
)
-
margin
.
right
|
0
;
var
width
=
(
460
-
margin
.
left
|
0
)
-
margin
.
right
|
0
;
var
height
=
(
400
-
margin
.
top
|
0
)
-
margin
.
bottom
|
0
;
var
height
=
(
400
-
margin
.
top
|
0
)
-
margin
.
bottom
|
0
;
var
svg
=
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableSelection
)(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableSelection
)(
Graphics_D3_Selection
.
rootSelect
(
"#contour"
))(
"svg"
))(
new
Data_Tuple
.
Tuple
(
"width"
,
(
width
+
margin
.
left
|
0
)
+
margin
.
right
|
0
)))(
new
Data_Tuple
.
Tuple
(
"height"
,
(
height
+
margin
.
top
|
0
)
+
margin
.
bottom
|
0
)))(
"g"
))(
new
Data_Tuple
.
Tuple
(
"transform"
,
"translate("
+
(
Data_Show
.
show
(
Data_Show
.
showInt
)(
margin
.
left
)
+
(
", "
+
(
Data_Show
.
show
(
Data_Show
.
showInt
)(
margin
.
top
)
+
")"
)))))();
var
contour
=
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableSelection
)(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableSelection
)(
Graphics_D3_Selection
.
rootSelect
(
"#contour"
))(
"svg"
))(
new
Data_Tuple
.
Tuple
(
"width"
,
(
width
+
margin
.
left
|
0
)
+
margin
.
right
|
0
)))(
new
Data_Tuple
.
Tuple
(
"height"
,
(
height
+
margin
.
top
|
0
)
+
margin
.
bottom
|
0
)))(
"g"
))(
new
Data_Tuple
.
Tuple
(
"transform"
,
"translate("
+
(
Data_Show
.
show
(
Data_Show
.
showInt
)(
margin
.
left
)
+
(
", "
+
(
Data_Show
.
show
(
Data_Show
.
showInt
)(
margin
.
top
)
+
")"
)))))();
Effect_Aff
.
launchAff_
((
function
()
{
Effect_Aff
.
launchAff_
((
function
()
{
var
handleRow
=
function
(
d
)
{
var
handleRow
=
function
(
d
)
{
var
v
=
Control_Monad_Except
.
runExcept
(
Control_Bind
.
bindFlipped
(
Control_Monad_Except_Trans
.
bindExceptT
(
Data_Identity
.
monadIdentity
))(
Data_Traversable
.
traverse
(
Data_Traversable
.
traversableArray
)(
Control_Monad_Except_Trans
.
applicativeExceptT
(
Data_Identity
.
monadIdentity
))(
Foreign
.
readNumber
(
Data_Identity
.
monadIdentity
)))(
Foreign
.
readArray
(
Data_Identity
.
monadIdentity
)(
d
)));
var
v
=
Control_Monad_Except
.
runExcept
(
Control_Bind
.
bindFlipped
(
Control_Monad_Except_Trans
.
bindExceptT
(
Data_Identity
.
monadIdentity
))(
Data_Traversable
.
traverse
(
Data_Traversable
.
traversableArray
)(
Control_Monad_Except_Trans
.
applicativeExceptT
(
Data_Identity
.
monadIdentity
))(
Foreign
.
readNumber
(
Data_Identity
.
monadIdentity
)))(
Foreign
.
readArray
(
Data_Identity
.
monadIdentity
)(
d
)));
...
@@ -3411,32 +3491,32 @@ var PS = {};
...
@@ -3411,32 +3491,32 @@ var PS = {};
y
:
v2
.
value0
.
head
y
:
v2
.
value0
.
head
};
};
};
};
throw
new
Error
(
"Failed pattern match at Main (line
78, column 40 - line 80
, column 64): "
+
[
v2
.
constructor
.
name
]);
throw
new
Error
(
"Failed pattern match at Main (line
80, column 40 - line 82
, column 64): "
+
[
v2
.
constructor
.
name
]);
};
};
throw
new
Error
(
"Failed pattern match at Main (line 7
6, column 15 - line 80
, column 64): "
+
[
v1
.
constructor
.
name
]);
throw
new
Error
(
"Failed pattern match at Main (line 7
8, column 15 - line 82
, column 64): "
+
[
v1
.
constructor
.
name
]);
};
};
throw
new
Error
(
"Failed pattern match at Main (line 7
3, column 11 - line 80
, column 64): "
+
[
v
.
constructor
.
name
]);
throw
new
Error
(
"Failed pattern match at Main (line 7
5, column 11 - line 82
, column 64): "
+
[
v
.
constructor
.
name
]);
};
};
return
Control_Bind
.
bind
(
Effect_Aff
.
bindAff
)(
Graphics_D3_Request
.
csv
(
"https://raw.githubusercontent.com/holtzy/D3-graph-gallery/master/DATA/data_for_density2d.csv"
)(
handleRow
))(
function
(
data$prime1
)
{
return
Control_Bind
.
bind
(
Effect_Aff
.
bindAff
)(
Graphics_D3_Request
.
csv
(
"https://raw.githubusercontent.com/holtzy/D3-graph-gallery/master/DATA/data_for_density2d.csv"
)(
handleRow
))(
function
(
data$prime1
)
{
return
Control_Bind
.
discard
(
Control_Bind
.
discardUnit
)(
Effect_Aff
.
bindAff
)(
Effect_Class
.
liftEffect
(
Effect_Aff
.
monadEffectAff
)(
DOM_Simple_Console
.
log2
(
"data'"
)(
data$prime1
)))(
function
()
{
return
Control_Bind
.
discard
(
Control_Bind
.
discardUnit
)(
Effect_Aff
.
bindAff
)(
Effect_Class
.
liftEffect
(
Effect_Aff
.
monadEffectAff
)(
DOM_Simple_Console
.
log2
(
"data'"
)(
data$prime1
)))(
function
()
{
return
Effect_Class
.
liftEffect
(
Effect_Aff
.
monadEffectAff
)(
function
__do
()
{
return
Effect_Class
.
liftEffect
(
Effect_Aff
.
monadEffectAff
)(
function
__do
()
{
var
x
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Scale
.
linearScale
)(
Graphics_D3_Scale
.
domain
(
Graphics_D3_Scale
.
scaleLinear
)([
5.0
,
20.0
])))(
Graphics_D3_Scale
.
range
(
Graphics_D3_Scale
.
scaleLinear
)([
0.0
,
Data_Int
.
toNumber
(
width
)
]))();
var
x
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Scale
.
linearScale
)(
Graphics_D3_Scale
.
domain
(
Graphics_D3_Scale
.
scaleLinear
)([
5.0
,
20.0
])))(
Graphics_D3_Scale
.
range
(
Graphics_D3_Scale
.
scaleLinear
)([
0.0
,
Data_Int
.
toNumber
(
width
)
]))();
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
append
(
Graphics_D3_Selection
.
appendableSelection
)(
"g"
)(
svg
))(
new
Data_Tuple
.
Tuple
(
"transform"
,
"translate(0, "
+
(
Data_Show
.
show
(
Data_Show
.
showInt
)(
height
)
+
")"
)))();
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
append
(
Graphics_D3_Selection
.
appendableSelection
)(
"g"
)(
contour
))(
new
Data_Tuple
.
Tuple
(
"transform"
,
"translate(0, "
+
(
Data_Show
.
show
(
Data_Show
.
showInt
)(
height
)
+
")"
)))();
var
y
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Scale
.
linearScale
)(
Graphics_D3_Scale
.
domain
(
Graphics_D3_Scale
.
scaleLinear
)([
5.0
,
22.0
])))(
Graphics_D3_Scale
.
range
(
Graphics_D3_Scale
.
scaleLinear
)([
Data_Int
.
toNumber
(
height
),
0.0
]))();
var
y
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Scale
.
linearScale
)(
Graphics_D3_Scale
.
domain
(
Graphics_D3_Scale
.
scaleLinear
)([
5.0
,
22.0
])))(
Graphics_D3_Scale
.
range
(
Graphics_D3_Scale
.
scaleLinear
)([
Data_Int
.
toNumber
(
height
),
0.0
]))();
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Applicative
.
pure
(
Effect
.
applicativeEffect
)(
svg
))(
Graphics_D3_Selection
.
append
(
Graphics_D3_Selection
.
appendableSelection
)(
"g"
))();
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Applicative
.
pure
(
Effect
.
applicativeEffect
)(
contour
))(
Graphics_D3_Selection
.
append
(
Graphics_D3_Selection
.
appendableSelection
)(
"g"
))();
var
densityData
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Contour
.
contourDensity
)(
Graphics_D3_Contour
[
"x'"
](
Graphics_D3_Contour
.
contourDensityContour
)(
function
(
d
)
{
var
densityData
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Contour
.
contourDensity
)(
Graphics_D3_Contour
[
"x'"
](
Graphics_D3_Contour
.
contourDensityContour
)(
function
(
d
)
{
return
d
.
x
;
return
d
.
x
;
})))(
Graphics_D3_Contour
[
"y'"
](
Graphics_D3_Contour
.
contourDensityContour
)(
function
(
d
)
{
})))(
Graphics_D3_Contour
[
"y'"
](
Graphics_D3_Contour
.
contourDensityContour
)(
function
(
d
)
{
return
d
.
y
;
return
d
.
y
;
})))(
Graphics_D3_Contour
.
size
(
Graphics_D3_Contour
.
contourDensityContour
)([
Data_Int
.
toNumber
(
width
),
Data_Int
.
toNumber
(
height
)
])))(
Graphics_D3_Contour
.
bandwidth
(
Graphics_D3_Contour
.
contourDensityContour
)(
20.0
)))(
Graphics_D3_Contour
.
toFunction
(
Graphics_D3_Contour
.
contourDensityContour
))();
})))(
Graphics_D3_Contour
.
size
(
Graphics_D3_Contour
.
contourDensityContour
)([
Data_Int
.
toNumber
(
width
),
Data_Int
.
toNumber
(
height
)
])))(
Graphics_D3_Contour
.
bandwidth
(
Graphics_D3_Contour
.
contourDensityContour
)(
20.0
)))(
Graphics_D3_Contour
.
toFunction
(
Graphics_D3_Contour
.
contourDensityContour
))();
DOM_Simple_Console
.
log2
(
"densityData(data')"
)(
densityData
(
data$prime1
))();
DOM_Simple_Console
.
log2
(
"densityData(data')"
)(
densityData
(
data$prime1
))();
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableEnter
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Applicative
.
pure
(
Effect
.
applicativeEffect
)(
svg
))(
Graphics_D3_Selection
.
selectAll
(
"path"
)))(
Graphics_D3_Selection
.
bindData
(
densityData
(
data$prime1
))))(
Graphics_D3_Selection
.
enter
))(
"path"
))(
new
Data_Tuple
.
Tuple
(
"d"
,
Graphics_D3_Contour
.
geoPath
)))(
new
Data_Tuple
.
Tuple
(
"fill"
,
"none"
)))(
new
Data_Tuple
.
Tuple
(
"stroke"
,
"#69b3a2"
)))(
new
Data_Tuple
.
Tuple
(
"stroke-linejoin"
,
"round"
))();
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableEnter
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Applicative
.
pure
(
Effect
.
applicativeEffect
)(
contour
))(
Graphics_D3_Selection
.
selectAll
(
"path"
)))(
Graphics_D3_Selection
.
bindData
(
densityData
(
data$prime1
))))(
Graphics_D3_Selection
.
enter
))(
"path"
))(
new
Data_Tuple
.
Tuple
(
"d"
,
Graphics_D3_Contour
.
geoPath
)))(
new
Data_Tuple
.
Tuple
(
"fill"
,
"none"
)))(
new
Data_Tuple
.
Tuple
(
"stroke"
,
"#69b3a2"
)))(
new
Data_Tuple
.
Tuple
(
"stroke-linejoin"
,
"round"
))();
return
Data_Unit
.
unit
;
return
Data_Unit
.
unit
;
});
});
});
});
});
});
})())();
})())();
DOM_Simple_Console
.
log2
(
"
svg"
)(
svg
)();
DOM_Simple_Console
.
log2
(
"
contour"
)(
contour
)();
var
axisScale
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Scale
.
linearScale
)(
Graphics_D3_Scale
.
domain
(
Graphics_D3_Scale
.
scaleLinear
)([
-
1.0
,
10.0
])))(
Graphics_D3_Scale
.
range
(
Graphics_D3_Scale
.
scaleLinear
)([
0.0
,
400.0
]))();
var
axisScale
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Scale
.
linearScale
)(
Graphics_D3_Scale
.
domain
(
Graphics_D3_Scale
.
scaleLinear
)([
-
1.0
,
10.0
])))(
Graphics_D3_Scale
.
range
(
Graphics_D3_Scale
.
scaleLinear
)([
0.0
,
400.0
]))();
var
xAxis
=
Graphics_D3_SVG_Axis
.
axisBottom
(
Graphics_D3_Scale
.
scaleLinear
)(
axisScale
)();
var
xAxis
=
Graphics_D3_SVG_Axis
.
axisBottom
(
Graphics_D3_Scale
.
scaleLinear
)(
axisScale
)();
var
axisSvg
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableSelection
)(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableSelection
)(
Graphics_D3_Selection
.
rootSelect
(
"#axis"
))(
"svg"
))(
new
Data_Tuple
.
Tuple
(
"width"
,
400
)))(
new
Data_Tuple
.
Tuple
(
"height"
,
50
)))(
"g"
))(
Graphics_D3_SVG_Axis
.
renderAxis
(
Graphics_D3_Selection
.
existingSelection
)(
xAxis
))();
var
axisSvg
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableSelection
)(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAppend
(
Graphics_D3_Selection
.
appendableSelection
)(
Graphics_D3_Selection
.
rootSelect
(
"#axis"
))(
"svg"
))(
new
Data_Tuple
.
Tuple
(
"width"
,
400
)))(
new
Data_Tuple
.
Tuple
(
"height"
,
50
)))(
"g"
))(
Graphics_D3_SVG_Axis
.
renderAxis
(
Graphics_D3_Selection
.
existingSelection
)(
xAxis
))();
...
@@ -3505,14 +3585,32 @@ var PS = {};
...
@@ -3505,14 +3585,32 @@ var PS = {};
})))(
new
Data_Tuple
.
Tuple
(
"stroke"
,
"black"
)))(
new
Data_Tuple
.
Tuple
(
"font-size"
,
"0.5em"
))();
})))(
new
Data_Tuple
.
Tuple
(
"stroke"
,
"black"
)))(
new
Data_Tuple
.
Tuple
(
"font-size"
,
"0.5em"
))();
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Selection
.
selectAll
(
"path"
)(
linkG
))(
Graphics_D3_Selection
.
bindData
(
linkNodeData
)))(
Graphics_D3_Selection
.
join
(
Graphics_D3_Selection
.
joinableUpdate
)(
"path"
)))(
new
Data_Tuple
.
Tuple
(
"d"
,
linkGen
)))(
new
Data_Tuple
.
Tuple
(
"fill"
,
"none"
)))(
new
Data_Tuple
.
Tuple
(
"stroke"
,
"black"
))();
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Graphics_D3_Selection
.
combineAttr
(
Graphics_D3_Selection
.
existingSelection
)()(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Selection
.
selectAll
(
"path"
)(
linkG
))(
Graphics_D3_Selection
.
bindData
(
linkNodeData
)))(
Graphics_D3_Selection
.
join
(
Graphics_D3_Selection
.
joinableUpdate
)(
"path"
)))(
new
Data_Tuple
.
Tuple
(
"d"
,
linkGen
)))(
new
Data_Tuple
.
Tuple
(
"fill"
,
"none"
)))(
new
Data_Tuple
.
Tuple
(
"stroke"
,
"black"
))();
var
linkZoom
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Zoom
.
zoom
)(
Graphics_D3_Zoom
.
on
(
"zoom"
)(
function
(
ze
)
{
var
linkZoom
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Zoom
.
zoom
)(
Graphics_D3_Zoom
.
on
(
"zoom"
)(
function
(
ze
)
{
return
Effect_Unsafe
.
unsafePerformEffect
(
function
__do
()
{
return
function
__do
()
{
DOM_Simple_Console
.
log2
(
"zoom"
)(
ze
)();
DOM_Simple_Console
.
log2
(
"zoom"
)(
ze
)();
Graphics_D3_Selection
.
attr
(
Graphics_D3_Selection
.
existingSelection
)()(
"transform"
)(
Graphics_D3_Zoom
.
transform
(
Graphics_D3_Zoom
[
"$_TransformableZoomE_0"
])(
ze
))(
linkG
)();
Graphics_D3_Selection
.
attr
(
Graphics_D3_Selection
.
existingSelection
)()(
"transform"
)(
Graphics_D3_Zoom
.
transform
(
Graphics_D3_Zoom
[
"$_TransformableZoomE_0"
])(
ze
))(
linkG
)();
return
Data_Unit
.
unit
;
return
Data_Unit
.
unit
;
}
)
;
};
}))();
}))();
Graphics_D3_Zoom
.
renderZoom
(
Graphics_D3_Selection
.
existingSelection
)(
linkZoom
)(
linkElSvg
)();
Graphics_D3_Zoom
.
renderZoom
(
Graphics_D3_Selection
.
existingSelection
)(
linkZoom
)(
linkElSvg
)();
return
DOM_Simple_Console
.
log2
(
"linkEl"
)(
linkElSvg
)();
DOM_Simple_Console
.
log2
(
"linkEl"
)(
linkElSvg
)();
var
resetZoomEl
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Graphics_D3_Selection
.
rootSelect
(
"#reset-zoom"
))(
Graphics_D3_Selection
.
onClick
(
Graphics_D3_Selection
.
clickableSelection
)(
function
(
v
)
{
return
function
__do
()
{
Graphics_D3_Selection
.
call
(
Graphics_D3_Selection
.
callableSelection
)(
Graphics_D3_Zoom
.
transform
(
Graphics_D3_Zoom
[
"$_TransformableZoom_1"
])(
linkZoom
))(
Graphics_D3_Zoom
.
zoomIdentity
)(
linkG
)();
return
DOM_Simple_Console
.
log
(
"zoom reset"
)();
};
}))();
DOM_Simple_Console
.
log2
(
"resetZoomEl"
)(
resetZoomEl
)();
Effect_Aff
.
launchAff_
(
Control_Bind
.
bind
(
Effect_Aff
.
bindAff
)(
Graphics_D3_Request
.
xml
(
"http://localhost:8888/data/employees.xml"
))(
function
(
xmlData
)
{
return
Control_Bind
.
discard
(
Control_Bind
.
discardUnit
)(
Effect_Aff
.
bindAff
)(
Effect_Class
.
liftEffect
(
Effect_Aff
.
monadEffectAff
)(
DOM_Simple_Console
.
log2
(
"xml"
)(
xmlData
)))(
function
()
{
return
Effect_Class
.
liftEffect
(
Effect_Aff
.
monadEffectAff
)(
function
__do
()
{
var
selXml
=
Graphics_D3_Selection
.
rootSelect
(
"#xml"
)();
DOM_Simple_Console
.
log2
(
"selXml"
)(
selXml
)();
var
rows
=
Control_Bind
.
bind
(
Effect
.
bindEffect
)(
Web_DOM_Document
.
getElementsByTagName
(
"row"
)(
xmlData
))(
Web_DOM_HTMLCollection
.
toArray
)();
return
DOM_Simple_Console
.
log2
(
"rows"
)(
rows
)();
});
});
}))();
return
DOM_Simple_Console
.
log
(
"xml done"
)();
};
};
exports
[
"main"
]
=
main
;
exports
[
"main"
]
=
main
;
})(
PS
);
})(
PS
);
...
...
example/packages.dhall
View file @
0ee1f55e
...
@@ -99,7 +99,7 @@ in upstream
...
@@ -99,7 +99,7 @@ in upstream
-------------------------------
-------------------------------
-}
-}
let upstream =
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.14.2/packages.dhall sha256:
5f10380b3ca7d3a32ea5c2b7535e4814a5e3f3590c70692f76e596d6ab0687b3
https://github.com/purescript/package-sets/releases/download/psc-0.14.2/packages.dhall sha256:
64d7b5a1921e8458589add8a1499a1c82168e726a87fc4f958b3f8760cca2efe
let reactix-d3-additions = ../packages-additions.dhall
let reactix-d3-additions = ../packages-additions.dhall
...
...
example/spago.dhall
View file @
0ee1f55e
...
@@ -29,6 +29,7 @@ to generate this file without the comments in this block.
...
@@ -29,6 +29,7 @@ to generate this file without the comments in this block.
, "reactix-d3"
, "reactix-d3"
, "transformers"
, "transformers"
, "tuples"
, "tuples"
, "web-dom"
]
]
, packages = ./packages.dhall
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
...
...
example/src/Main.purs
View file @
0ee1f55e
...
@@ -16,6 +16,8 @@ import Effect.Class (liftEffect)
...
@@ -16,6 +16,8 @@ import Effect.Class (liftEffect)
import Effect.Unsafe (unsafePerformEffect)
import Effect.Unsafe (unsafePerformEffect)
import Foreign
import Foreign
import Math
import Math
import Web.DOM.Document as WDD
import Web.DOM.HTMLCollection as WDH
import Graphics.D3.Base
import Graphics.D3.Base
import Graphics.D3.Contour as Contour
import Graphics.D3.Contour as Contour
...
@@ -62,7 +64,7 @@ main = do
...
@@ -62,7 +64,7 @@ main = do
let margin = {top: 20, right: 30, bottom: 30, left: 40}
let margin = {top: 20, right: 30, bottom: 30, left: 40}
width = 460 - margin.left - margin.right
width = 460 - margin.left - margin.right
height = 400 - margin.top - margin.bottom
height = 400 - margin.top - margin.bottom
svg
<- Selection.rootSelect "#contour"
contour
<- Selection.rootSelect "#contour"
>=>++ "svg"
>=>++ "svg"
>=> Tuple "width" (width + margin.left + margin.right)
>=> Tuple "width" (width + margin.left + margin.right)
>=> Tuple "height" (height + margin.top + margin.bottom)
>=> Tuple "height" (height + margin.top + margin.bottom)
...
@@ -84,14 +86,14 @@ main = do
...
@@ -84,14 +86,14 @@ main = do
x <- Scale.linearScale
x <- Scale.linearScale
>>= Scale.domain [5.0, 20.0]
>>= Scale.domain [5.0, 20.0]
>>= Scale.range [0.0, toNumber width]
>>= Scale.range [0.0, toNumber width]
_ <- Selection.append "g"
svg
_ <- Selection.append "g"
contour
>=> Tuple "transform" ("translate(0, " <> show height <> ")")
>=> Tuple "transform" ("translate(0, " <> show height <> ")")
-- TODO call (d3.axisBottom(x))
-- TODO call (d3.axisBottom(x))
y <- Scale.linearScale
y <- Scale.linearScale
>>= Scale.domain [5.0, 22.0]
>>= Scale.domain [5.0, 22.0]
>>= Scale.range [toNumber height, 0.0]
>>= Scale.range [toNumber height, 0.0]
_ <- pure
svg
>>= Selection.append "g"
_ <- pure
contour
>>= Selection.append "g"
-- TODO call (d3.axisLeft(y))
-- TODO call (d3.axisLeft(y))
densityData <- Contour.contourDensity
densityData <- Contour.contourDensity
...
@@ -103,7 +105,7 @@ main = do
...
@@ -103,7 +105,7 @@ main = do
log2 "densityData(data')" $ densityData data'
log2 "densityData(data')" $ densityData data'
_ <- pure
svg
_ <- pure
contour
>>= Selection.selectAll "path"
>>= Selection.selectAll "path"
>>= Selection.bindData (densityData data')
>>= Selection.bindData (densityData data')
>>= Selection.enter
>>= Selection.enter
...
@@ -113,7 +115,7 @@ main = do
...
@@ -113,7 +115,7 @@ main = do
>=> Tuple "stroke" "#69b3a2"
>=> Tuple "stroke" "#69b3a2"
>=> Tuple "stroke-linejoin" "round"
>=> Tuple "stroke-linejoin" "round"
pure unit
pure unit
log2 "
svg" svg
log2 "
contour" contour
-- visualize axis
-- visualize axis
axisScale <- Scale.linearScale
axisScale <- Scale.linearScale
...
@@ -199,13 +201,25 @@ main = do
...
@@ -199,13 +201,25 @@ main = do
>=> Tuple "fill" "none"
>=> Tuple "fill" "none"
>=> Tuple "stroke" "black"
>=> Tuple "stroke" "black"
linkZoom <- Zoom.zoom
linkZoom <- Zoom.zoom
>>= Zoom.on "zoom" (\ze ->
unsafePerformEffect $
do
>>= Zoom.on "zoom" (\ze -> do
_ <- log2 "zoom" ze
_ <- log2 "zoom" ze
_ <- Selection.attr "transform" (Zoom.transform ze) linkG
_ <- Selection.attr "transform" (Zoom.transform ze) linkG
pure unit)
pure unit)
_ <- Zoom.renderZoom linkZoom linkElSvg
_ <- Zoom.renderZoom linkZoom linkElSvg
-- resetZoomEl <- Selection.selectAll "#reset-zoom"
-- >>= Selection.onClick (\_ -> do
-- _ <- Selection.call (Zoom.transform linkZoom) Zoom.zoomIdentity linkG
-- pure unit)
log2 "linkEl" linkElSvg
log2 "linkEl" linkElSvg
resetZoomEl <- Selection.rootSelect "#reset-zoom"
>>= Selection.onClick (\_ -> do
_ <- Selection.call (Zoom.transform linkZoom) Zoom.zoomIdentity linkG
log "zoom reset")
log2 "resetZoomEl" resetZoomEl
launchAff_ $ do
xmlData <- xml "http://localhost:8888/data/employees.xml"
liftEffect $ log2 "xml" xmlData
liftEffect $ do
selXml <- Selection.rootSelect "#xml"
log2 "selXml" selXml
rows <- WDD.getElementsByTagName "row" xmlData >>= WDH.toArray
log2 "rows" rows
log "xml done"
example/static/data/employees.xml
0 → 100644
View file @
0ee1f55e
<?xml version="1.0" encoding="UTF-8"?>
<root>
<row>
<Name>
John
</Name>
<Age>
30
</Age>
</row>
<row>
<Name>
Jane
</Name>
<Age>
32
</Age>
</row>
</root>
example/static_serve.js
0 → 100644
View file @
0ee1f55e
var
fs
=
require
(
'fs'
),
http
=
require
(
'http'
);
var
dir
=
__dirname
+
'/static'
;
console
.
log
(
'Serving at port 8888, dir'
,
dir
);
http
.
createServer
(
function
(
req
,
res
)
{
fs
.
readFile
(
dir
+
req
.
url
,
function
(
err
,
data
)
{
if
(
err
)
{
res
.
writeHead
(
404
);
res
.
end
(
JSON
.
stringify
(
err
));
return
;
}
res
.
setHeader
(
'Access-Control-Allow-Origin'
,
'*'
);
res
.
writeHead
(
200
);
res
.
end
(
data
);
});
}).
listen
(
8888
);
example/yarn.lock
View file @
0ee1f55e
...
@@ -5997,6 +5997,14 @@ parallel-transform@^1.1.0:
...
@@ -5997,6 +5997,14 @@ parallel-transform@^1.1.0:
inherits "^2.0.3"
inherits "^2.0.3"
readable-stream "^2.1.5"
readable-stream "^2.1.5"
parcel-plugin-static-files-copy@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/parcel-plugin-static-files-copy/-/parcel-plugin-static-files-copy-2.6.0.tgz#06d7d9b6d7e2071b2e261315e94209b522108beb"
integrity sha512-k3YxdnEQWo1aMfCeBfxgUNJWuUE0O730EGiGBcmWEUOto7f1jM/8oxBKXkVZsXDCO1o00dw5X7CsT+yF0JY4qA==
dependencies:
minimatch "3.0.4"
path "0.12.7"
parcel@^2.0.0-beta.2:
parcel@^2.0.0-beta.2:
version "2.0.0-beta.2"
version "2.0.0-beta.2"
resolved "https://registry.yarnpkg.com/parcel/-/parcel-2.0.0-beta.2.tgz#0a58f0b810fe2199b35d7bf7a949906568222d75"
resolved "https://registry.yarnpkg.com/parcel/-/parcel-2.0.0-beta.2.tgz#0a58f0b810fe2199b35d7bf7a949906568222d75"
...
@@ -6122,6 +6130,14 @@ path-to-regexp@2.2.1:
...
@@ -6122,6 +6130,14 @@ path-to-regexp@2.2.1:
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-2.2.1.tgz#90b617025a16381a879bc82a38d4e8bdeb2bcf45"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-2.2.1.tgz#90b617025a16381a879bc82a38d4e8bdeb2bcf45"
integrity sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==
integrity sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==
path@0.12.7:
version "0.12.7"
resolved "https://registry.yarnpkg.com/path/-/path-0.12.7.tgz#d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f"
integrity sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=
dependencies:
process "^0.11.1"
util "^0.10.3"
pbkdf2@^3.0.3:
pbkdf2@^3.0.3:
version "3.1.2"
version "3.1.2"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075"
...
@@ -6606,7 +6622,7 @@ process-nextick-args@~2.0.0:
...
@@ -6606,7 +6622,7 @@ process-nextick-args@~2.0.0:
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
process@^0.11.10, process@~0.11.0:
process@^0.11.1
, process@^0.11.1
0, process@~0.11.0:
version "0.11.10"
version "0.11.10"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI=
integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI=
...
@@ -8142,6 +8158,13 @@ util@0.10.3:
...
@@ -8142,6 +8158,13 @@ util@0.10.3:
dependencies:
dependencies:
inherits "2.0.1"
inherits "2.0.1"
util@^0.10.3, util@~0.10.1:
version "0.10.4"
resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901"
integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==
dependencies:
inherits "2.0.3"
util@^0.12.0, util@^0.12.3:
util@^0.12.0, util@^0.12.3:
version "0.12.4"
version "0.12.4"
resolved "https://registry.yarnpkg.com/util/-/util-0.12.4.tgz#66121a31420df8f01ca0c464be15dfa1d1850253"
resolved "https://registry.yarnpkg.com/util/-/util-0.12.4.tgz#66121a31420df8f01ca0c464be15dfa1d1850253"
...
@@ -8154,13 +8177,6 @@ util@^0.12.0, util@^0.12.3:
...
@@ -8154,13 +8177,6 @@ util@^0.12.0, util@^0.12.3:
safe-buffer "^5.1.2"
safe-buffer "^5.1.2"
which-typed-array "^1.1.2"
which-typed-array "^1.1.2"
util@~0.10.1:
version "0.10.4"
resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901"
integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==
dependencies:
inherits "2.0.3"
utils-merge@1.0.1:
utils-merge@1.0.1:
version "1.0.1"
version "1.0.1"
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
...
...
packages-additions.dhall
View file @
0ee1f55e
{
--
d3 = ../purescript-d3/spago.dhall as Location
{ d3 = ../purescript-d3/spago.dhall as Location
d3 =
{-
d3 =
{ dependencies = (https://raw.githubusercontent.com/cgenie/purescript-d3/master/spago.dhall sha256:8b7ccc57d93feec9c8eece52c67318fcd88b9fc3bee0eec3dd1224b5d55a5452).dependencies
{ dependencies = (https://raw.githubusercontent.com/cgenie/purescript-d3/master/spago.dhall sha256:8b7ccc57d93feec9c8eece52c67318fcd88b9fc3bee0eec3dd1224b5d55a5452).dependencies
, repo = "https://github.com/cgenie/purescript-d3"
, repo = "https://github.com/cgenie/purescript-d3"
, version = "master"
, version = "master"
}
}
-}
, dom-simple =
, dom-simple =
{ dependencies =
{ dependencies =
[ "console"
[ "console"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment