Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native Plot respects the height parameters #10546

Merged
merged 3 commits into from
Feb 8, 2025
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
6 changes: 6 additions & 0 deletions .changeset/great-llamas-read.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@gradio/nativeplot": patch
"gradio": patch
---

fix:Native Plot respects the height parameters
2 changes: 2 additions & 0 deletions js/nativeplot/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@
: [])
],
width: chart_element.offsetWidth,
height: height ? "container" : undefined,
title: title || undefined
};
/* eslint-enable complexity */
Expand Down Expand Up @@ -561,6 +562,7 @@
<style>
div {
width: 100%;
height: 100%;
}
:global(#vg-tooltip-element) {
font-family: var(--font) !important;
Expand Down
30 changes: 30 additions & 0 deletions js/nativeplot/NativePlot.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,36 @@
}}
/>

<Story
name="Line Plot with height"
args={{
value: {
columns: ["time", "value"],
data: [
[1, 10],
[2, 15],
[3, 13],
[4, 17],
[5, 14],
[6, 20]
],
datatypes: {
time: "quantitative",
value: "quantitative"
},
mark: "line"
},
x: "time",
y: "value",
title: "Sample Line Plot",
x_title: "Time",
y_title: "Value",
height: 250,
label: "Line Plot",
show_label: true
}}
/>

<Story
name="Empty Plot"
args={{
Expand Down
Loading