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
Expand all
Hide 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 @@
<div
id=
"time-axis"
></div>
<div
id=
"links"
></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 -->
<script
type=
"text/javascript"
src=
"/index.fd532818.js"
></script>
...
...
example/index.html
View file @
0ee1f55e
...
...
@@ -33,6 +33,7 @@
<div
id=
"time-axis"
></div>
<div
id=
"links"
></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 -->
<script
type=
"text/javascript"
src=
"index.js"
></script>
...
...
example/index.js
View file @
0ee1f55e
This diff is collapsed.
Click to expand it.
example/packages.dhall
View file @
0ee1f55e
...
...
@@ -99,7 +99,7 @@ in 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
...
...
example/spago.dhall
View file @
0ee1f55e
...
...
@@ -29,6 +29,7 @@ to generate this file without the comments in this block.
, "reactix-d3"
, "transformers"
, "tuples"
, "web-dom"
]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
...
...
example/src/Main.purs
View file @
0ee1f55e
...
...
@@ -16,6 +16,8 @@ import Effect.Class (liftEffect)
import Effect.Unsafe (unsafePerformEffect)
import Foreign
import Math
import Web.DOM.Document as WDD
import Web.DOM.HTMLCollection as WDH
import Graphics.D3.Base
import Graphics.D3.Contour as Contour
...
...
@@ -62,7 +64,7 @@ main = do
let margin = {top: 20, right: 30, bottom: 30, left: 40}
width = 460 - margin.left - margin.right
height = 400 - margin.top - margin.bottom
svg
<- Selection.rootSelect "#contour"
contour
<- Selection.rootSelect "#contour"
>=>++ "svg"
>=> Tuple "width" (width + margin.left + margin.right)
>=> Tuple "height" (height + margin.top + margin.bottom)
...
...
@@ -84,14 +86,14 @@ main = do
x <- Scale.linearScale
>>= Scale.domain [5.0, 20.0]
>>= Scale.range [0.0, toNumber width]
_ <- Selection.append "g"
svg
_ <- Selection.append "g"
contour
>=> Tuple "transform" ("translate(0, " <> show height <> ")")
-- TODO call (d3.axisBottom(x))
y <- Scale.linearScale
>>= Scale.domain [5.0, 22.0]
>>= Scale.range [toNumber height, 0.0]
_ <- pure
svg
>>= Selection.append "g"
_ <- pure
contour
>>= Selection.append "g"
-- TODO call (d3.axisLeft(y))
densityData <- Contour.contourDensity
...
...
@@ -103,7 +105,7 @@ main = do
log2 "densityData(data')" $ densityData data'
_ <- pure
svg
_ <- pure
contour
>>= Selection.selectAll "path"
>>= Selection.bindData (densityData data')
>>= Selection.enter
...
...
@@ -113,7 +115,7 @@ main = do
>=> Tuple "stroke" "#69b3a2"
>=> Tuple "stroke-linejoin" "round"
pure unit
log2 "
svg" svg
log2 "
contour" contour
-- visualize axis
axisScale <- Scale.linearScale
...
...
@@ -199,13 +201,25 @@ main = do
>=> Tuple "fill" "none"
>=> Tuple "stroke" "black"
linkZoom <- Zoom.zoom
>>= Zoom.on "zoom" (\ze ->
unsafePerformEffect $
do
>>= Zoom.on "zoom" (\ze -> do
_ <- log2 "zoom" ze
_ <- Selection.attr "transform" (Zoom.transform ze) linkG
pure unit)
_ <- 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
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:
inherits "^2.0.3"
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:
version "2.0.0-beta.2"
resolved "https://registry.yarnpkg.com/parcel/-/parcel-2.0.0-beta.2.tgz#0a58f0b810fe2199b35d7bf7a949906568222d75"
...
...
@@ -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"
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:
version "3.1.2"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075"
...
...
@@ -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"
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"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI=
...
...
@@ -8142,6 +8158,13 @@ util@0.10.3:
dependencies:
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:
version "0.12.4"
resolved "https://registry.yarnpkg.com/util/-/util-0.12.4.tgz#66121a31420df8f01ca0c464be15dfa1d1850253"
...
...
@@ -8154,13 +8177,6 @@ util@^0.12.0, util@^0.12.3:
safe-buffer "^5.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:
version "1.0.1"
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 =
{ d3 = ../purescript-d3/spago.dhall as Location
{-
d3 =
{ dependencies = (https://raw.githubusercontent.com/cgenie/purescript-d3/master/spago.dhall sha256:8b7ccc57d93feec9c8eece52c67318fcd88b9fc3bee0eec3dd1224b5d55a5452).dependencies
, repo = "https://github.com/cgenie/purescript-d3"
, version = "master"
}
-}
, dom-simple =
{ dependencies =
[ "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