Skip to content

Commit

Permalink
docs(example): improve histogram nonlinear example (vega#8738)Co-auth…
Browse files Browse the repository at this point in the history
…ored-by: GitHub Actions Bot <vega-actions-bot@users.noreply.github.com>

* docs(example): improve histogram nonlinear example

* fix: broken types in tests

* chore: update examples [CI]

---------

Co-authored-by: GitHub Actions Bot <vega-actions-bot@users.noreply.github.com>
  • Loading branch information
2 people authored and BradyJ27 committed Oct 19, 2023
1 parent 0a09ec3 commit 135d4ff
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 14 deletions.
1 change: 1 addition & 0 deletions examples/compiled/arc_color_mappings.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"padding": 5,
"width": 200,
"height": 200,
"style": "view",
"data": [
{
"name": "source_0",
Expand Down
1 change: 1 addition & 0 deletions examples/compiled/arc_pie_normalize_tooltip.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"padding": 5,
"width": 200,
"height": 200,
"style": "view",
"data": [
{
"name": "source_0",
Expand Down
Binary file modified examples/compiled/dynamic_color_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/compiled/dynamic_color_legend.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 14 additions & 5 deletions examples/compiled/dynamic_color_legend.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"name": "source_0",
"url": "data/seattle-weather.csv",
"format": {"type": "csv", "parse": {"date": "date"}, "delimiter": ","}
"format": {"type": "csv", "parse": {"date": "date"}}
},
{
"name": "data_0",
Expand Down Expand Up @@ -66,7 +66,9 @@
{
"name": "unit",
"value": {},
"on": [{"events": "mousemove", "update": "isTuple(group()) ? group() : unit"}]
"on": [
{"events": "mousemove", "update": "isTuple(group()) ? group() : unit"}
]
},
{
"name": "brush",
Expand Down Expand Up @@ -103,7 +105,9 @@
"events": {
"source": "scope",
"type": "mousedown",
"filter": ["!event.item || event.item.mark.name !== \"brush_brush\""]
"filter": [
"!event.item || event.item.mark.name !== \"brush_brush\""
]
},
"update": "[x(unit), x(unit)]"
},
Expand All @@ -116,7 +120,9 @@
{
"source": "scope",
"type": "mousedown",
"filter": ["!event.item || event.item.mark.name !== \"brush_brush\""]
"filter": [
"!event.item || event.item.mark.name !== \"brush_brush\""
]
},
{"source": "window", "type": "mouseup"}
]
Expand Down Expand Up @@ -361,7 +367,10 @@
},
{"value": 0}
],
"stroke": [{"test": "brush_x[0] !== brush_x[1]", "value": "white"}, {"value": null}]
"stroke": [
{"test": "brush_x[0] !== brush_x[1]", "value": "white"},
{"value": null}
]
}
}
}
Expand Down
Binary file modified examples/compiled/histogram_nonlinear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/compiled/histogram_nonlinear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion examples/compiled/histogram_nonlinear.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"background": "white",
"padding": 5,
"height": 100,
"title": {"text": "Distribution of Frame Render Time (ms)", "frame": "group"},
"title": {
"text": "Distribution of Frame Render Time (fps)",
"frame": "group"
},
"style": "cell",
"data": [
{
Expand Down Expand Up @@ -103,6 +106,15 @@
"grid": false,
"labelAngle": 0,
"labelBaseline": "top",
"encode": {
"labels": {
"update": {
"text": {
"signal": "datum.value === '∞' ? '0' : format(1000/datum.value, 'd')"
}
}
}
},
"zindex": 0
},
{
Expand Down
1 change: 1 addition & 0 deletions examples/compiled/interactive_geo_earthquakes.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"padding": 5,
"width": 300,
"height": 300,
"style": "view",
"data": [
{"name": "source_0", "values": [{"type": "Sphere"}]},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/specs/histogram_nonlinear.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
]
},
"title": "Distribution of Frame Render Time (ms)",
"title": "Distribution of Frame Render Time (fps)",
"width": {"step": 40},
"height": 100,
"mark": {"type": "bar", "cornerRadiusEnd": 0, "orient": "vertical"},
Expand All @@ -55,7 +55,7 @@
"field": "startTime",
"type": "ordinal",
"scale": {"type": "point", "padding": 0},
"axis": {"labelAngle": 0},
"axis": {"labelAngle": 0, "labelExpr": "datum.value === '∞' ? '0' : format(1000/datum.value, 'd')"},
"sort": null
},
"x2": {"field": "endTime"},
Expand Down
4 changes: 2 additions & 2 deletions test-runtime/interval.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ describe('interval selections at runtime in unit views', () => {
describe('geo-intervals', () => {
it('should add IDs to the store', async () => {
await embed(geoSpec());
const store = await page.evaluate(brush('drag', 1));
const store: any = await page.evaluate(brush('drag', 1));
expect(store).toHaveLength(13);
for (const t of store) {
expect(t).toHaveProperty('_vgsid_');
Expand All @@ -211,7 +211,7 @@ describe('interval selections at runtime in unit views', () => {

it('should respect projections', async () => {
await embed(geoSpec({encodings: ['longitude']}));
const store = await page.evaluate(brush('drag', 0));
const store: any = await page.evaluate(brush('drag', 0));
expect(store).toHaveLength(20);
for (const t of store) {
expect(t).toHaveProperty('_vgsid_');
Expand Down
2 changes: 1 addition & 1 deletion test-runtime/translate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ describe('Translate interval selections at runtime', () => {
await testRender(`geo-0`);

for (let i = 0; i < hits.translate.length; i++) {
const translate = await page.evaluate(brush('translate', i, null, true));
const translate: any = await page.evaluate(brush('translate', i, null, true));
expect(translate.length).toBeGreaterThan(0);
await testRender(`geo-${i + 1}`);
}
Expand Down
2 changes: 1 addition & 1 deletion test-runtime/zoom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('Zoom interval selections at runtime', () => {
await testRender(`geo-0`);

for (let i = 0; i < hits.zoom.length; i++) {
const zoomed = await page.evaluate(zoom('zoom', i, i % 2 ? 'out' : 'in', null, true));
const zoomed: any = await page.evaluate(zoom('zoom', i, i % 2 ? 'out' : 'in', null, true));
expect(zoomed.length).toBeGreaterThan(0);
await testRender(`geo-${i + 1}`);
}
Expand Down

0 comments on commit 135d4ff

Please sign in to comment.