Skip to content

Commit 26a5ff6

Browse files
committed
Merge branch 'horizon' into vmt-initialState
2 parents 7e3b738 + dfbd511 commit 26a5ff6

19 files changed

+856
-208
lines changed

.slug-post-clean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/web/js/snap

.slugignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./chrome-linux64

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ before_deploy:
6060
- export GIT_BRANCH=`echo $TRAVIS_BRANCH`
6161
- heroku config:set --app pyret-horizon GIT_REV=$GIT_REV
6262
- heroku config:set --app pyret-horizon GIT_BRANCH=$GIT_REV
63-
- gem install faraday -v 2.8.1
64-
- gem install faraday-net_http -v 3.0.2
65-
- rvm install 2.7
6663
install:
6764
- git submodule init
6865
- git submodule update

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ build/web/js/events.js: src/web/js/events.js
112112
cp $< $@
113113

114114
build/web/js/snap: src/web/js/snap
115-
cp -r $< $@
116-
rm -rf $@/.git*
115+
mkdir -p build/web/js/snap
116+
cp -r $</src build/web/js/snap
117+
cp -r $</pyret build/web/js/snap
118+
cp -r $</libraries build/web/js/snap
117119

118120
build/web/js/transpile.xml: src/web/js/transpile.xml
119121
cp -r $< $@

src/web/arr/trove/chart.arr

Lines changed: 101 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,8 @@ type BarChartSeries = {
10571057
horizontal :: Boolean,
10581058
annotations :: RawArray<RawArray<Option<String>>>,
10591059
intervals :: RawArray<RawArray<RawArray<Number>>>,
1060-
default-interval-color :: Option<I.Color>
1060+
default-interval-color :: Option<I.Color>,
1061+
dot-chart :: Boolean,
10611062
}
10621063

10631064
default-bar-chart-series = {
@@ -1067,7 +1068,8 @@ default-bar-chart-series = {
10671068
pointer-color: none,
10681069
axisdata: none,
10691070
horizontal: false,
1070-
default-interval-color: none
1071+
default-interval-color: none,
1072+
dot-chart: false,
10711073
}
10721074

10731075
type MultiBarChartSeries = {
@@ -1127,6 +1129,7 @@ type LinePlotSeries = {
11271129
pointshapeSides :: NumInteger,
11281130
pointshapeDent :: Number,
11291131
pointshapeRotation :: Number,
1132+
dot-chart :: Boolean,
11301133
}
11311134

11321135
default-line-plot-series = {
@@ -1146,6 +1149,7 @@ default-line-plot-series = {
11461149
pointshapeSides: 5,
11471150
pointshapeDent: 0.5,
11481151
pointshapeRotation: 0,
1152+
dot-chart: false,
11491153
}
11501154

11511155
type ScatterPlotSeries = {
@@ -1162,6 +1166,7 @@ type ScatterPlotSeries = {
11621166
pointshapeSides :: NumInteger,
11631167
pointshapeDent :: Number,
11641168
pointshapeRotation :: Number,
1169+
dot-chart :: Boolean,
11651170
}
11661171

11671172
default-scatter-plot-series = {
@@ -1177,6 +1182,7 @@ default-scatter-plot-series = {
11771182
trendlineWidth: 3,
11781183
trendlineOpacity: 0.3,
11791184
trendlineDegree: 3,
1185+
dot-chart: false
11801186
}
11811187

11821188
type IntervalChartSeries = {
@@ -1191,9 +1197,6 @@ type IntervalChartSeries = {
11911197
style :: String,
11921198
horizontal :: Boolean,
11931199
default-interval-color :: Option<I.Color>,
1194-
#
1195-
bothys :: List<Posn>,
1196-
ps :: List<Posn>,
11971200
legend :: String,
11981201
trendlineType :: Option<String>,
11991202
trendlineColor :: Option<I.Color>,
@@ -1207,6 +1210,9 @@ type IntervalChartSeries = {
12071210
pointshapeSides :: NumInteger,
12081211
pointshapeDent :: Number,
12091212
pointshapeRotation :: Number,
1213+
bothys :: List<Posn>,
1214+
ps :: List<Posn>,
1215+
dot-chart :: Boolean,
12101216
}
12111217

12121218
default-interval-chart-series = {
@@ -1230,6 +1236,7 @@ default-interval-chart-series = {
12301236
pointshapeSides: 5,
12311237
pointshapeDent: 0.5,
12321238
pointshapeRotation: 0,
1239+
dot-chart: false,
12331240
}
12341241

12351242
type FunctionPlotSeries = {
@@ -1917,6 +1924,92 @@ fun bar-chart-from-list(labels :: P.LoS, values :: P.LoN) -> DataSeries block:
19171924
data-series.make-axis(max-positive-height, max-negative-height)
19181925
end
19191926

1927+
fun num-dot-chart-from-list(x-values :: P.LoN) -> DataSeries block:
1928+
doc: ```
1929+
Consume a (possibly repeating, unordered) list of numbers
1930+
and construct a dot chart
1931+
```
1932+
x-values.each(check-num)
1933+
when x-values.length() == 0:
1934+
raise("num-dot-chart: can't have empty data")
1935+
end
1936+
scatter-plot-ys = x-values.map(lam(_): 0 end)
1937+
default-scatter-plot-series.{
1938+
ps: map4({(x, y, z, img): [raw-array: x, y, z, img]},
1939+
x-values, scatter-plot-ys,
1940+
x-values.map({(_): ''}), x-values.map({(_): false})),
1941+
dot-chart: true
1942+
} ^ scatter-plot-series
1943+
end
1944+
1945+
fun labeled-num-dot-chart-from-list(labels :: P.LoS, x-values :: P.LoN) -> DataSeries block:
1946+
doc: ```
1947+
Consume unordered, possibly-repeating lists of labels and numbers,
1948+
and construct a dot chart
1949+
```
1950+
x-values.each(check-num)
1951+
when x-values.length() == 0:
1952+
raise("num-dot-chart: can't have empty data")
1953+
end
1954+
labels.each(check-string)
1955+
when labels.length() <> x-values.length():
1956+
raise("num-dot-chart: the lists of numbers and labels must have the same length")
1957+
end
1958+
scatter-plot-ys = x-values.map(lam(_): 0 end)
1959+
default-scatter-plot-series.{
1960+
ps: map4({(x, y, z, img): [raw-array: x, y, z, img]},
1961+
x-values, scatter-plot-ys, labels,
1962+
x-values.map({(_): false})),
1963+
dot-chart: true
1964+
} ^ scatter-plot-series
1965+
end
1966+
1967+
fun dot-chart-from-list(input-labels :: P.LoS) -> DataSeries block:
1968+
doc: ```
1969+
Consume a list of string-values and construct a dot chart
1970+
```
1971+
1972+
# Edge Case Error Checking
1973+
when input-labels.length() == 0:
1974+
raise("dot-chart: can't have empty data")
1975+
end
1976+
1977+
# Type Checking
1978+
input-labels.each(check-string)
1979+
1980+
# Walk through the (sorted) values, creating lists of labels and counts
1981+
unique-counts = foldl(
1982+
lam(acc, elt):
1983+
labels = acc.{0}
1984+
counts = acc.{1}
1985+
if labels.member(elt):
1986+
{labels; counts.set(0, counts.get(0) + 1)}
1987+
else:
1988+
{link(elt, labels); link(1, counts)}
1989+
end
1990+
end,
1991+
{[list: ]; [list: ]},
1992+
input-labels.sort())
1993+
1994+
labels = unique-counts.{0}
1995+
values = unique-counts.{1}
1996+
rational-values = map(num-to-rational, values)
1997+
1998+
# set the vAxis values, and create the data series
1999+
{max-positive-height; max-negative-height} = prep-axis(rational-values)
2000+
2001+
data-series = default-bar-chart-series.{
2002+
tab: to-table2-n(labels, rational-values),
2003+
dot-chart: true,
2004+
axis-top: max-positive-height,
2005+
axis-bottom: max-negative-height,
2006+
annotations: values.map({(_): [list: none]}) ^ list-to-table2,
2007+
intervals: values.map({(_): [list: [raw-array: ]]}) ^ list-to-table2,
2008+
} ^ bar-chart-series
2009+
2010+
data-series.make-axis(max-positive-height, max-negative-height)
2011+
end
2012+
19202013
fun grouped-bar-chart-from-list(
19212014
labels :: P.LoS,
19222015
value-lists :: P.LoLoN,
@@ -2613,6 +2706,9 @@ from-list = {
26132706
exploding-pie-chart: exploding-pie-chart-from-list,
26142707
image-pie-chart: image-pie-chart-from-list,
26152708
bar-chart: bar-chart-from-list,
2709+
dot-chart: dot-chart-from-list,
2710+
num-dot-chart: num-dot-chart-from-list,
2711+
labeled-num-dot-chart: labeled-num-dot-chart-from-list,
26162712
image-bar-chart: image-bar-chart-from-list,
26172713
grouped-bar-chart: grouped-bar-chart-from-list,
26182714
stacked-bar-chart: stacked-bar-chart-from-list,

0 commit comments

Comments
 (0)