Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
490 changes: 267 additions & 223 deletions tfjs-vis/demos/api/yarn.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions tfjs-vis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tensorflow/tfjs-vis",
"version": "1.4.0",
"version": "1.4.2",
"description": "Utilities for in browser visualization with TensorFlow.js",
"repository": "https://github.com/tensorflow/tfjs-vis",
"license": "Apache-2.0",
Expand All @@ -24,12 +24,12 @@
"d3-selection": "~1.3.0",
"glamor": "~2.20.40",
"preact": "~8.2.9",
"vega": "5.4.0",
"vega-embed": "5.1.2",
"vega-lite": "4.0.2"
"vega": "5.12.3",
"vega-embed": "6.8.0",
"vega-lite": "4.13.1"
},
"devDependencies": {
"@tensorflow/tfjs": "~1.0.0",
"@tensorflow/tfjs": "~1.7.4",
"@types/d3-format": "~1.3.0",
"@types/d3-selection": "~1.3.2",
"@types/jasmine": "~2.8.8",
Expand Down
2 changes: 2 additions & 0 deletions tfjs-vis/src/render/confusion_matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export async function confusionMatrix(
'titleFontSize': options.fontSize,
}
},
//@ts-ignore
'data': {'values': values},
'encoding': {
'x': {
Expand Down Expand Up @@ -185,6 +186,7 @@ export async function confusionMatrix(
'color': {
'field': 'scaleCount',
'type': 'quantitative',
//@ts-ignore
'scale': {'range': options.colorMap},
},
'tooltip': [
Expand Down
3 changes: 3 additions & 0 deletions tfjs-vis/src/render/heatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export async function heatmap(
},
'scale': {'bandPaddingInner': 0, 'bandPaddingOuter': 0},
},
//@ts-ignore
'data': {'values': values},
'mark': {'type': 'rect', 'tooltip': true},
'encoding': {
Expand Down Expand Up @@ -228,12 +229,14 @@ export async function heatmap(
}

if (colorRange !== 'viridis') {
//@ts-ignore
const fill = spec.encoding.fill;
// @ts-ignore
fill.scale = {'range': colorRange};
}

if (options.domain) {
//@ts-ignore
const fill = spec.encoding.fill;
// @ts-ignore
if (fill.scale != null) {
Expand Down
5 changes: 5 additions & 0 deletions tfjs-vis/src/render/histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export async function histogram(
renderStats(stats, statsContainer, {fontSize: options.fontSize});
}

// If there are no data values return early
if (values.length === 0) {
return undefined;
}

// Now that we have rendered stats we need to remove any NaNs and Infinities
// before rendering the histogram
const filtered = [];
Expand Down
2 changes: 1 addition & 1 deletion tfjs-vis/src/render/histogram_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('renderHistogram', () => {
await histogram(container, data);
}).not.toThrow();

expect(document.querySelectorAll('.vega-embed').length).toBe(1);
expect(document.querySelectorAll('.vega-embed').length).toBe(0);
expect(document.querySelectorAll('table').length).toBe(1);
expect(document.querySelectorAll('table thead tr').length).toBe(1);
expect(document.querySelectorAll('table thead th').length).toBe(3);
Expand Down
1 change: 1 addition & 0 deletions tfjs-vis/src/render/scatterplot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export async function scatterplot(
'titleFontSize': options.fontSize,
}
},
//@ts-ignore
'data': {
'values': values,
},
Expand Down
Loading