Skip to content

Commit

Permalink
add Matrix operator
Browse files Browse the repository at this point in the history
Currently only for quantitative and XY comparisons
  • Loading branch information
JoshDavid committed Sep 18, 2023
1 parent cd2403a commit 2d2b5e6
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 30 deletions.
17 changes: 8 additions & 9 deletions APLSource/API/BoxPlot.aplf
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
BoxPlot{
⍵ ←→ APL matrix with headers
⍺ ←→ Optional existing HTML document (WIP -- prob need a full param ns)
##.Utils.Alpha''
ns##.Spec.New''
ns.description'vertical box plot'
ns.width800
ns.height400
m'mark'ns.⎕NS''
s##.Spec.GetSpecNS ns
s.description'vertical box plot'
s.width800
s.height400
m'mark's.⎕NS''
m.type'boxplot'
m.extent'min-max'
nsns ##.Spec.PackageArgs
_ns ##.Spec.PackData
_##.Spec.AddColor ns
nsns ##.Spec.InjectData
j##.Spec.ToJson ns
##.Html.Render j
.HtmlRendererObj ##.Html.Render ns
}
10 changes: 4 additions & 6 deletions APLSource/API/HeatMap.aplf
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
HeatMap{
⍵ ←→ APL matrix with headers
⍺ ←→ Optional parameter namespace
##.Utils.Alpha ''
##.Utils.Alpha''
ns##.Spec.New .SpecOverride
ns.description'Grid heat map'
ns.width800
ns.height400
m'mark'ns.⎕NS''
m.type'rect'
_ns ##.Spec.PackageArgs
_'z'##.Spec.AddColor ns
a'config.axis'ns.⎕NS''
a.grid'true'
a.tickBand'extent'
nsns ##.Spec.InjectData
j##.Spec.ToJson ns
.HtmlRendererObj ##.Html.Render j
_ns ##.Spec.PackData
_'z'##.Spec.AddColor ns
.HtmlRendererObj ##.Html.Render ns
}
23 changes: 23 additions & 0 deletions APLSource/API/Matrix.aplo
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Matrix{
Operator -- all combinations of ⍵
Limited to 2D comparisons currently
AND type of quantitative for now
⍺ ←→ Optional ParamNS
⍺⍺ ←→ Plot fn
⍵ ←→ Data
##.Utils.Alpha''
o.SpecOverride
r'repeat'o.⎕NS''
h,1
r.rowh
r.columnh
s'spec' o.⎕NS ''
e'encoding's.⎕NS''
_'xy'{
t e.⎕NS''
t.type'quantitative'
f'field't.⎕NS''
f.repeat 0
}¨'column' 'row'
⍺⍺
}
19 changes: 9 additions & 10 deletions APLSource/API/ScatterPlot.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
⍺ ←→ Optional existing HTML document (WIP -- prob need a full param ns)
TODO: Multi scatter plots in a new fn ? Or figure out how to
Represent several arguments w diff shapes/colors on same graph
ns##.Spec.New''
ns.description'Scatter plot'
ns.width800
ns.height400
ns.mark'point'
nsns ##.Spec.PackageArgs
nsns ##.Spec.InjectData
j##.Spec.ToJson ns
##.Html.Render j
##.Utils.Alpha''
ns##.Spec.New .SpecOverride
s##.Spec.GetSpecNS ns
s.description'Scatter plot'
s.width800
s.height400
s.mark'point'
_ns ##.Spec.PackData
.HtmlRendererObj ##.Html.Render ns
}
3 changes: 1 addition & 2 deletions APLSource/Demo/CorrelationHeatMap.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
Special case of HeatMap used for viewing correlations
a##.Utils.Alpha''
oa.SpecOverride
f'encoding.color.scale'
_f o.⎕NS'' sof
s'encoding.color.scale' o.⎕NS ''
s.scheme'redblue'
s.domain¯1 1
a ##.API.HeatMap
Expand Down
5 changes: 3 additions & 2 deletions APLSource/Html/Render.aplf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Render{
⍺ ←→ HR object, creates one if none passed in
⍵ ←→ JSON string of the spec
⍵ ←→ NS of the entire spec
j##.Spec.ToJson
NewHtmlRender''
InjectJson
InjectJson j
}
5 changes: 5 additions & 0 deletions APLSource/Spec/GetSpecNS.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GetSpecNS{
VL specs require nesting certain properties under spec sometimes -- but not always. Argh!
9=.⎕NC 'spec':.spec
}
1 change: 1 addition & 0 deletions APLSource/Spec/InitEncoding.aplf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
InitEncoding{
⍵ ←→ ns
9=.⎕NC 'encoding': For now
e'encoding'.⎕NS''
s'size'e.⎕NS''
s.value90
Expand Down
10 changes: 10 additions & 0 deletions APLSource/Spec/PackData.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PackData{
⍺ ←→ master spec ns
⍵ ←→ data
e9.⎕NC'spec.encoding.x'
↑Hmm, done for Matrix op, definitly need to discuss cons of this approach:
e.g.: partial x spec done outside of Mat op?
_ PackageArgs(e)
_ InjectData
0
}
2 changes: 1 addition & 1 deletion APLSource/Utils/Alpha.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Generates default left arg that can be passed to any API function
a⎕NS''
a.HtmlRendererObj
a.SpecOverride⎕NS'' NS, VL String, or both? Override/augment default spec with this
a.SpecOverride(UniqueName'a') ⎕NS '' NS, VL String, or both? Override/augment default spec with this
a
a.ReuseExistingHR ⍝ Experiment with: Keep a cached "invisible" HRobj to allow quick displays?
a.DocumentLandingDiv ⍝ Where the image should land on an existing page...
Expand Down

0 comments on commit 2d2b5e6

Please sign in to comment.