Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Commit 5c38241

Browse files
committed
Update tests and examples to use Glyph() instead of new Glyph()
1 parent 244d213 commit 5c38241

28 files changed

+107
-107
lines changed

anscombe/src/main/scala/Anscombe.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ object Anscombe extends js.JSApp {
6262
val ygrid = new Grid().plot(plot).axis(yaxis).dimension(1)
6363
val line_renderer = new GlyphRenderer()
6464
.data_source(lines_source)
65-
.glyph(new Line().x(x).y(y).line_color("#666699").line_width(2))
65+
.glyph(Line().x(x).y(y).line_color("#666699").line_width(2))
6666
val circle_renderer = new GlyphRenderer()
6767
.data_source(circles_source)
68-
.glyph(new Circle().x(xname).y(yname).size(12).fill_color("#cc6633").line_color("#cc6633").fill_alpha(50%%))
68+
.glyph(Circle().x(xname).y(yname).size(12).fill_color("#cc6633").line_color("#cc6633").fill_alpha(50%%))
6969
plot.renderers := List(xaxis, yaxis, xgrid, ygrid, line_renderer, circle_renderer)
7070
plot
7171
}

bokeh/src/test/scala/Bokeh.scala

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -101,102 +101,102 @@ class BokehSpec extends Specification {
101101

102102
"glyphs" should {
103103
"support AnnularWedge" in {
104-
val obj = new AnnularWedge()
104+
val obj = AnnularWedge()
105105
obj.fields.length shouldEqual 18
106106
}
107107

108108
"support Annulus" in {
109-
val obj = new Annulus()
109+
val obj = Annulus()
110110
obj.fields.length shouldEqual 15
111111
}
112112

113113
"support Arc" in {
114-
val obj = new Arc()
114+
val obj = Arc()
115115
obj.fields.length shouldEqual 15
116116
}
117117

118118
"support Bezier" in {
119-
val obj = new Bezier()
119+
val obj = Bezier()
120120
obj.fields.length shouldEqual 17
121121
}
122122

123123
"support ImageRGBA" in {
124-
val obj = new ImageRGBA()
124+
val obj = ImageRGBA()
125125
obj.fields.length shouldEqual 10
126126
}
127127

128128
"support Image" in {
129-
val obj = new Image()
129+
val obj = Image()
130130
obj.fields.length shouldEqual 11
131131
}
132132

133133
"support ImageURL" in {
134-
val obj = new ImageURL()
134+
val obj = ImageURL()
135135
obj.fields.length shouldEqual 13
136136
}
137137

138138
"support Line" in {
139-
val obj = new Line()
139+
val obj = Line()
140140
obj.fields.length shouldEqual 11
141141
}
142142

143143
"support MultiLine" in {
144-
val obj = new MultiLine()
144+
val obj = MultiLine()
145145
obj.fields.length shouldEqual 11
146146
}
147147

148148
"support Oval" in {
149-
val obj = new Oval()
149+
val obj = Oval()
150150
obj.fields.length shouldEqual 16
151151
}
152152

153153
"support Patch" in {
154-
val obj = new Patch()
154+
val obj = Patch()
155155
obj.fields.length shouldEqual 13
156156
}
157157

158158
"support Patches" in {
159-
val obj = new Patches()
159+
val obj = Patches()
160160
obj.fields.length shouldEqual 13
161161
}
162162

163163
"support Quad" in {
164-
val obj = new Quad()
164+
val obj = Quad()
165165
obj.fields.length shouldEqual 15
166166
}
167167

168168
"support Quadratic" in {
169-
val obj = new Quadratic()
169+
val obj = Quadratic()
170170
obj.fields.length shouldEqual 15
171171
}
172172

173173
"support Ray" in {
174-
val obj = new Ray()
174+
val obj = Ray()
175175
obj.fields.length shouldEqual 13
176176
}
177177

178178
"support Rect" in {
179-
val obj = new Rect()
179+
val obj = Rect()
180180
obj.fields.length shouldEqual 17
181181
}
182182

183183
"support Segment" in {
184-
val obj = new Segment()
184+
val obj = Segment()
185185
obj.fields.length shouldEqual 13
186186
}
187187

188188
"support Text" in {
189-
val obj = new Text()
189+
val obj = Text()
190190
obj.fields.length shouldEqual 15
191191
}
192192

193193
"support Wedge" in {
194-
val obj = new Wedge()
194+
val obj = Wedge()
195195
obj.fields.length shouldEqual 17
196196
}
197197

198198
"support Gear" in {
199-
val obj = new Gear()
199+
val obj = Gear()
200200
obj.fields.length shouldEqual 19
201201
}
202202
}
@@ -248,67 +248,67 @@ class BokehSpec extends Specification {
248248

249249
"markers" should {
250250
"support Asterisk" in {
251-
val obj = new Asterisk()
251+
val obj = Asterisk()
252252
obj.fields.length shouldEqual 15
253253
}
254254

255255
"support Circle" in {
256-
val obj = new Circle()
256+
val obj = Circle()
257257
obj.fields.length shouldEqual 17
258258
}
259259

260260
"support CircleCross" in {
261-
val obj = new CircleCross()
261+
val obj = CircleCross()
262262
obj.fields.length shouldEqual 15
263263
}
264264

265265
"support CircleX" in {
266-
val obj = new CircleX()
266+
val obj = CircleX()
267267
obj.fields.length shouldEqual 15
268268
}
269269

270270
"support Cross" in {
271-
val obj = new Cross()
271+
val obj = Cross()
272272
obj.fields.length shouldEqual 15
273273
}
274274

275275
"support Diamond" in {
276-
val obj = new Diamond()
276+
val obj = Diamond()
277277
obj.fields.length shouldEqual 15
278278
}
279279

280280
"support DiamondCross" in {
281-
val obj = new DiamondCross()
281+
val obj = DiamondCross()
282282
obj.fields.length shouldEqual 15
283283
}
284284

285285
"support InvertedTriangle" in {
286-
val obj = new InvertedTriangle()
286+
val obj = InvertedTriangle()
287287
obj.fields.length shouldEqual 15
288288
}
289289

290290
"support Square" in {
291-
val obj = new Square()
291+
val obj = Square()
292292
obj.fields.length shouldEqual 15
293293
}
294294

295295
"support SquareCross" in {
296-
val obj = new SquareCross()
296+
val obj = SquareCross()
297297
obj.fields.length shouldEqual 15
298298
}
299299

300300
"support SquareX" in {
301-
val obj = new SquareX()
301+
val obj = SquareX()
302302
obj.fields.length shouldEqual 15
303303
}
304304

305305
"support Triangle" in {
306-
val obj = new Triangle()
306+
val obj = Triangle()
307307
obj.fields.length shouldEqual 15
308308
}
309309

310310
"support PlainX" in {
311-
val obj = new PlainX()
311+
val obj = PlainX()
312312
obj.fields.length shouldEqual 15
313313
}
314314
}

examples/src/main/scala/models/Anscombe.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ object Anscombe extends Example {
5858
val ygrid = new Grid().plot(plot).axis(yaxis).dimension(1)
5959
val line_renderer = new GlyphRenderer()
6060
.data_source(lines)
61-
.glyph(new Line().x(lines.x).y(lines.y).line_color("#666699").line_width(2))
61+
.glyph(Line().x(lines.x).y(lines.y).line_color("#666699").line_width(2))
6262
val circle_renderer = new GlyphRenderer()
6363
.data_source(circles)
64-
.glyph(new Circle().x(x_col).y(y_col).size(12).fill_color("#cc6633").line_color("#cc6633").fill_alpha(50%%))
64+
.glyph(Circle().x(x_col).y(y_col).size(12).fill_color("#cc6633").line_color("#cc6633").fill_alpha(50%%))
6565
plot.renderers := List(xaxis, yaxis, xgrid, ygrid, line_renderer, circle_renderer)
6666
plot
6767
}

examples/src/main/scala/models/Calendars.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ object Calendars extends Example {
9696
.height(300)
9797
.outline_line_color()
9898

99-
val days_glyph = new Rect().x('days).y('weeks).width(0.9).height(0.9).fill_color('day_backgrounds).line_color(Color.Silver)
99+
val days_glyph = Rect().x('days).y('weeks).width(0.9).height(0.9).fill_color('day_backgrounds).line_color(Color.Silver)
100100
val days_renderer = new GlyphRenderer().data_source(source).glyph(days_glyph)
101101

102-
val holidays_glyph = new Rect().x('holidays_days).y('holidays_weeks).width(0.9).height(0.9).fill_color(Color.Pink).line_color(Color.IndianRed)
102+
val holidays_glyph = Rect().x('holidays_days).y('holidays_weeks).width(0.9).height(0.9).fill_color(Color.Pink).line_color(Color.IndianRed)
103103
val holidays_renderer = new GlyphRenderer().data_source(holidays_source).glyph(holidays_glyph)
104104

105-
val text_glyph = new Text().x('days).y('weeks).text('day_labels).text_align(TextAlign.Center).text_baseline(TextBaseline.Middle)
105+
val text_glyph = Text().x('days).y('weeks).text('day_labels).text_align(TextAlign.Center).text_baseline(TextBaseline.Middle)
106106
val text_renderer = new GlyphRenderer().data_source(source).glyph(text_glyph)
107107

108108
val xaxis = new CategoricalAxis()

examples/src/main/scala/models/Choropleth.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ object Choropleth extends Example {
4444
val xdr = new DataRange1d()
4545
val ydr = new DataRange1d()
4646

47-
val county_patches = new Patches()
47+
val county_patches = Patches()
4848
.xs(county_xs)
4949
.ys(county_ys)
5050
.fill_color(county_colors)
5151
.fill_alpha(0.7)
5252
.line_color(Color.White)
5353
.line_width(0.5)
5454

55-
val state_patches = new Patches()
55+
val state_patches = Patches()
5656
.xs(state_xs)
5757
.ys(state_ys)
5858
.fill_alpha(0.0)

examples/src/main/scala/models/ColorSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object ColorSpec extends Example {
1414
val xdr = new DataRange1d()
1515
val ydr = new DataRange1d()
1616

17-
val circle = new Circle().x(x).y(y).size(15).fill_color(color).line_color(Color.Black)
17+
val circle = Circle().x(x).y(y).size(15).fill_color(color).line_color(Color.Black)
1818

1919
val renderer = new GlyphRenderer()
2020
.data_source(source)

examples/src/main/scala/models/Colors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ object Colors extends Example {
161161
val plot = new Plot().title("CSS3 Color Names").x_range(xdr).y_range(ydr).width(600).height(2000)
162162

163163
// TODO: categorical dimensions; using Column would cause type error
164-
val rect_glyph = new Rect().x('groups).y('names).width(1).height(1).fill_color(colors).line_color()
164+
val rect_glyph = Rect().x('groups).y('names).width(1).height(1).fill_color(colors).line_color()
165165
val rect = new GlyphRenderer().data_source(source).glyph(rect_glyph)
166166

167167
val x1axis = new CategoricalAxis().plot(plot).major_label_orientation(pi/4)

examples/src/main/scala/models/DataTables.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ object DataTables extends Example {
3535
val yaxis = new LinearAxis().plot(plot)
3636
val ygrid = new Grid().plot(plot).dimension(1).ticker(yaxis.ticker.value)
3737
plot.left <<= (yaxis :: _)
38-
val cty_glyph = new Circle().x('index).y(cty).fill_color("#396285").size(8).fill_alpha(0.5).line_alpha(0.5)
39-
val hwy_glyph = new Circle().x('index).y(hwy).fill_color("#CE603D").size(8).fill_alpha(0.5).line_alpha(0.5)
38+
val cty_glyph = Circle().x('index).y(cty).fill_color("#396285").size(8).fill_alpha(0.5).line_alpha(0.5)
39+
val hwy_glyph = Circle().x('index).y(hwy).fill_color("#CE603D").size(8).fill_alpha(0.5).line_alpha(0.5)
4040
val cty_renderer = new GlyphRenderer().data_source(source).glyph(cty_glyph)
4141
val hwy_renderer = new GlyphRenderer().data_source(source).glyph(hwy_glyph)
4242
plot.renderers := List(cty_renderer, hwy_renderer, xaxis, yaxis, ygrid)

examples/src/main/scala/models/DateAxis.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ object DateAxis extends Example {
1818
val xdr = new DataRange1d()
1919
val ydr = new DataRange1d()
2020

21-
val circle = new Circle().x(times).y(y).fill_color(Color.Red).size(5).line_color(Color.Black)
21+
val circle = Circle().x(times).y(y).fill_color(Color.Red).size(5).line_color(Color.Black)
2222

2323
val renderer = new GlyphRenderer()
2424
.data_source(source)

examples/src/main/scala/models/Daylight.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ object Daylight extends Example {
5757
val sources = List(source, patch1_source, patch2_source, text_source)
5858
val plot = new Plot().title(title).x_range(xdr).y_range(ydr).width(800).height(400)
5959

60-
val patch1 = new Patch().x('dates).y('times).fill_color(Color.SkyBlue).fill_alpha(0.8)
60+
val patch1 = Patch().x('dates).y('times).fill_color(Color.SkyBlue).fill_alpha(0.8)
6161
val patch1_glyph = new GlyphRenderer().data_source(patch1_source).glyph(patch1)
6262

63-
val patch2 = new Patch().x('dates).y('times).fill_color(Color.Orange).fill_alpha(0.8)
63+
val patch2 = Patch().x('dates).y('times).fill_color(Color.Orange).fill_alpha(0.8)
6464
val patch2_glyph = new GlyphRenderer().data_source(patch2_source).glyph(patch2)
6565

66-
val line1 = new Line().x('dates).y('sunrises).line_color(Color.Yellow).line_width(2)
66+
val line1 = Line().x('dates).y('sunrises).line_color(Color.Yellow).line_width(2)
6767
val line1_glyph = new GlyphRenderer().data_source(source).glyph(line1)
6868

69-
val line2 = new Line().x('dates).y('sunsets).line_color(Color.Red).line_width(2)
69+
val line2 = Line().x('dates).y('sunsets).line_color(Color.Red).line_width(2)
7070
val line2_glyph = new GlyphRenderer().data_source(source).glyph(line2)
7171

72-
val text = new Text().x('dates).y('times).text('texts).angle(0).text_align(TextAlign.Center)
72+
val text = Text().x('dates).y('times).text('texts).angle(0).text_align(TextAlign.Center)
7373
val text_glyph = new GlyphRenderer().data_source(text_source).glyph(text)
7474

7575
val glyphs = List(patch1_glyph, patch2_glyph, line1_glyph, line2_glyph, text_glyph)

0 commit comments

Comments
 (0)