-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
awb99
committed
Nov 14, 2024
1 parent
4ab8328
commit 9f60c98
Showing
9 changed files
with
128 additions
and
19 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
demo/.reval/public/rdocument/demo/notebook/echarts/notebook.edn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
; saved on 2024-11-13 20:46:57 | ||
{:content [{:out "", | ||
:id :fa9a6188-36c9-4ef8-8742-8d89aa2890ec, | ||
:code "(ns demo.notebook.echarts\n (:require\n [tablecloth.api :as tc]\n [rtable.plot :as plot]\n [demo.random-bars :refer [random-bar-ds]]\n [demo.env :refer [env]]))", | ||
:ns "demo.notebook.echarts", | ||
:result ^{:dali true} | ||
{:viewer-fn dali.viewer.hiccup/hiccup, | ||
:data [:span | ||
{:style {:color "grey"}} | ||
"nil"]}} | ||
{:out "", | ||
:id :f70b5186-e0e2-4d48-8870-00d000798235, | ||
:code "(plot/echarts\n {:style {:width \"600px\"\n :height \"300px\"}\n :data {:xAxis {:type \"category\"\n :data [\"Mon\" \"Tue\" \"Wed\" \"Thu\" \"Fri\" \"Sat\" \"Sun\"]}\n :yAxis {:type \"value\"}\n :series [{:data [150 230 224 218 135 147 260]\n :type \"line\"}]}})", | ||
:ns "demo.notebook.echarts", | ||
:result ^{:dali true} | ||
{:viewer-fn rtable.viewer.echarts/echarts, | ||
:data {:style {:width "600px", | ||
:height "300px"}, | ||
:class nil, | ||
:data {:xAxis {:type "category", | ||
:data ["Mon" | ||
"Tue" | ||
"Wed" | ||
"Thu" | ||
"Fri" | ||
"Sat" | ||
"Sun"]}, | ||
:yAxis {:type "value"}, | ||
:series [{:data [150 | ||
230 | ||
224 | ||
218 | ||
135 | ||
147 | ||
260], | ||
:type "line"}]}}}}], | ||
:meta {:id :a92696c6-d64a-49ee-8c60-0c0315acd117, | ||
:eval-time "2024-11-14T01:46:57.231455491Z", | ||
:ns "demo.notebook.echarts", | ||
:java "19.0.2", | ||
:clojure "1.11.1"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{:study (), :demo ({:nbns "demo.notebook.highchart", :ext "clj", :path "/home/florian/repo/pink-gorilla/dali-table/demo/src/demo/notebook/highchart.clj"} {:nbns "demo.notebook.highlightjs", :ext "clj"} {:nbns "demo.notebook.ajax", :ext "cljs"} {:nbns "demo.notebook.clojure-edn", :ext "cljs"} {:nbns "demo.notebook.clojure-string", :ext "cljs"} {:nbns "demo.notebook.dialog", :ext "cljs"} {:nbns "demo.notebook.fonts", :ext "cljs"} {:nbns "demo.notebook.frisk", :ext "cljs"} {:nbns "demo.notebook.goog-string", :ext "cljs"} {:nbns "demo.notebook.javelin", :ext "cljs"} {:nbns "demo.notebook.jsinterop", :ext "cljs"} {:nbns "demo.notebook.notify", :ext "cljs"} {:nbns "demo.notebook.page-nav", :ext "cljs"} {:nbns "demo.notebook.pprint", :ext "cljs"} {:nbns "demo.notebook.promesa", :ext "cljs"} {:nbns "demo.notebook.tailwind", :ext "cljs"})} | ||
{:study (), :demo ({:nbns "demo.notebook.echarts", :ext "clj", :path "/home/florian/repo/pink-gorilla/dali-table/demo/src/demo/notebook/echarts.clj"} {:nbns "demo.notebook.highchart", :ext "clj", :path "/home/florian/repo/pink-gorilla/dali-table/demo/src/demo/notebook/highchart.clj"} {:nbns "demo.notebook.highlightjs", :ext "clj"} {:nbns "demo.notebook.ajax", :ext "cljs"} {:nbns "demo.notebook.clojure-edn", :ext "cljs"} {:nbns "demo.notebook.clojure-string", :ext "cljs"} {:nbns "demo.notebook.dialog", :ext "cljs"} {:nbns "demo.notebook.fonts", :ext "cljs"} {:nbns "demo.notebook.frisk", :ext "cljs"} {:nbns "demo.notebook.goog-string", :ext "cljs"} {:nbns "demo.notebook.javelin", :ext "cljs"} {:nbns "demo.notebook.jsinterop", :ext "cljs"} {:nbns "demo.notebook.notify", :ext "cljs"} {:nbns "demo.notebook.page-nav", :ext "cljs"} {:nbns "demo.notebook.pprint", :ext "cljs"} {:nbns "demo.notebook.promesa", :ext "cljs"} {:nbns "demo.notebook.tailwind", :ext "cljs"})} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(ns demo.notebook.echarts | ||
(:require | ||
[tablecloth.api :as tc] | ||
[rtable.plot :as plot] | ||
[demo.random-bars :refer [random-bar-ds]] | ||
[demo.env :refer [env]])) | ||
|
||
|
||
(plot/echarts | ||
{:style {:width "600px" | ||
:height "300px"} | ||
:data {:xAxis {:type "category" | ||
:data ["Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun"]} | ||
:yAxis {:type "value"} | ||
:series [{:data [150 230 224 218 135 147 260] | ||
:type "line"}]}}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{:name "rtabke-echarts" | ||
; build | ||
:lazy true | ||
:cljs-namespace [rtable.viewer.echarts] | ||
:cljs-ns-bindings {'rtable.viewer.echarts {'echarts rtable.viewer.echarts/echarts}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(ns rtable.plot.echarts | ||
(:require | ||
[tech.v3.dataset :as tds] | ||
[tablecloth.api :as tc] | ||
[de.otto.nom.core :as nom] | ||
[dali.spec :refer [create-dali-spec]] | ||
[dali.plot.anomaly :as plot])) | ||
|
||
(defn echarts [{:keys [style class data] | ||
:or {style {:width "100%" :height "100%"}} | ||
:as opts}] | ||
(create-dali-spec | ||
{:viewer-fn 'rtable.viewer.echarts/echarts | ||
:data {:style style | ||
:class class | ||
:data data}})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(ns rtable.viewer.echarts | ||
(:require | ||
["echarts" :as ec])) | ||
|
||
(defn echarts | ||
[{:keys [style class data on register-map] | ||
:or {style {:width "100%" :height "100%"} | ||
class ""}}] | ||
(fn [] | ||
[:div | ||
{:style style | ||
:class class | ||
:ref (fn [el] | ||
(when el | ||
(when-let [[map-name map-options] register-map] | ||
(.registerMap ec | ||
map-name (clj->js map-options))) | ||
(let [chart (.init ec el)] | ||
(->> data | ||
clj->js | ||
(.setOption chart)) | ||
(some->> on | ||
(run! (fn [[event-type f]] | ||
(.on chart | ||
(name event-type) | ||
f)))))))}])) |