Last active
July 31, 2022 09:51
-
-
Save mikeananev/af6b6dcbe886a44de9b5b4736f5060b6 to your computer and use it in GitHub Desktop.
Revisions
-
mikeananev revised this gist
Jul 31, 2022 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,9 @@ (:import (org.knowm.xchart XYChart))) (def chart ^XYChart (c/xy-chart {"Sin" {:x (range 0 63) :y (range 0 63) :style {:marker-type :none}} "Cos" [(range 0 63) (range 0 63)]})) ;; 63 is the number of dots to plot -
mikeananev revised this gist
Jul 31, 2022 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,20 +6,20 @@ (:import (org.knowm.xchart XYChart))) (def chart ^XYChart (c/xy-chart {"Sin" [(range 0 63) (range 0 63)] "Cos" [(range 0 63) (range 0 63)]})) ;; 63 is the number of dots to plot (def frame (c/view chart)) (dotimes [n 100] (let [start-x (* 2.0 math/PI (+ (* 0.01 n) n)) x-data (range start-x (* 2.0 math/PI (+ (* 0.01 n) (inc n))) 0.1) sin-y-data (map math/sin x-data) cos-y-data (map math/cos x-data)] (Thread/sleep 28) (.updateXYSeries chart "Sin" x-data sin-y-data nil) (.updateXYSeries chart "Cos" x-data cos-y-data nil) (.revalidate (.getContentPane frame)) (.repaint (.getContentPane frame)))) -
mikeananev revised this gist
Jul 31, 2022 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,10 @@ (ns org.rssys.xchart (:gen-class) (:require [clojure.math :as math] [com.brunobonacci.mulog :as mulog] [com.hypirion.clj-xchart :as c]) (:import (org.knowm.xchart XYChart))) (def chart ^XYChart (c/xy-chart {"Expected rate" [(range 0 63) (range 0 63)]})) -
mikeananev revised this gist
Jul 31, 2022 . 1 changed file with 22 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,25 @@ (def chart ^XYChart (c/xy-chart {"Expected rate" [(range 0 63) (range 0 63)]})) (def frame (c/view chart)) (dotimes [n 100] (let [start-x (* 2.0 math/PI (+ (* 0.01 n) n)) x-data (range start-x (* 2.0 math/PI (+ (* 0.01 n) (inc n))) 0.1) y-data (map math/sin x-data)] (Thread/sleep 28) (.updateXYSeries chart "Expected rate" x-data y-data nil) (.revalidate (.getContentPane frame)) (.repaint (.getContentPane frame)))) ;;;;;;;;;;;;;;;;;;;;;; (def chart ^XYChart (c/xy-chart {"Expected rate" [(range 10 20) (range 20 30)]})) -
mikeananev revised this gist
Jul 30, 2022 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,4 +14,10 @@ (Thread/sleep 100) (.updateXYSeries chart "Expected rate" (repeatedly 10 #(rand-int 30)) (range 30 40) nil) (.revalidate (:contentPane (bean frame))) (.repaint (:contentPane (bean frame)))) (dotimes [n 100] (Thread/sleep 100) (.updateXYSeries chart "Expected rate" (repeatedly 10 #(rand-int 30)) (repeatedly 10 #(rand-int 90)) nil) (.revalidate (.getContentPane frame)) (.repaint (.getContentPane frame))) -
mikeananev revised this gist
Jul 30, 2022 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,9 @@ (.revalidate (:contentPane (bean frame))) (.repaint (:contentPane (bean frame))) (.revalidate (.getContentPane frame)) ;; the same (.repaint (.getContentPane frame)) (dotimes [n 100] (Thread/sleep 100) (.updateXYSeries chart "Expected rate" (repeatedly 10 #(rand-int 30)) (range 30 40) nil) -
mikeananev created this gist
Jul 30, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ (def chart ^XYChart (c/xy-chart {"Expected rate" [(range 10 20) (range 20 30)]})) (def frame (c/view chart)) (.updateXYSeries chart "Expected rate" (repeatedly 10 #(rand-int 10)) (range 30 40) nil) (.revalidate (:contentPane (bean frame))) (.repaint (:contentPane (bean frame))) (dotimes [n 100] (Thread/sleep 100) (.updateXYSeries chart "Expected rate" (repeatedly 10 #(rand-int 30)) (range 30 40) nil) (.revalidate (:contentPane (bean frame))) (.repaint (:contentPane (bean frame))))