-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update the
scaleFactor
property to allow setting different va…
…lues (#1051) * Update scaleFactor to support different values for each type * Update README * Add example * Add unit test
- Loading branch information
1 parent
1ed2526
commit 35be206
Showing
4 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>Vega-Embed for Vega-Lite</title> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/vega@5"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/vega-lite@5"></script> | ||
<script src="build/vega-embed.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div id="vis"></div> | ||
<script> | ||
async function run() { | ||
// const scaleFactor = 5; | ||
// or | ||
// const scaleFactor = { svg: 2, png: 5 }; | ||
// or | ||
// const scaleFactor = { svg: 2 }; | ||
// or | ||
const scaleFactor = { png: 5 }; | ||
|
||
const spec = { | ||
$schema: "https://vega.github.io/schema/vega-lite/v5.json", | ||
data: { | ||
values: [ | ||
{ a: "A", b: 28 }, | ||
{ a: "B", b: 55 }, | ||
{ a: "C", b: 43 }, | ||
{ a: "D", b: 91 }, | ||
{ a: "E", b: 81 }, | ||
{ a: "F", b: 53 }, | ||
{ a: "G", b: 19 }, | ||
{ a: "H", b: 87 }, | ||
{ a: "I", b: 52 }, | ||
], | ||
}, | ||
mark: "bar", | ||
encoding: { | ||
x: { field: "a", type: "nominal" }, | ||
y: { field: "b", type: "quantitative" }, | ||
tooltip: { field: "b", type: "quantitative" }, | ||
}, | ||
}; | ||
|
||
const result = await vegaEmbed("#vis", spec, { | ||
scaleFactor, | ||
tooltip: { theme: "dark" }, | ||
}); | ||
|
||
console.log(result); | ||
} | ||
run(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters