A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix(charts): pie chart innerRadius undefined incorrect rendering (#10104)
ohmdelta3e8e4395f3f4
diff --git a/frontend/src/components/data-table/charts/__tests__/altair-generator.test.ts b/frontend/src/components/data-table/charts/__tests__/altair-generator.test.tsindex 54a14eb4f6..f2d8d45fda 100644--- a/frontend/src/components/data-table/charts/__tests__/altair-generator.test.ts+++ b/frontend/src/components/data-table/charts/__tests__/altair-generator.test.ts@@ -85,6 +85,10 @@ const Mocks = {type: "arc",innerRadius: 100,},+ arcDefault: {+ type: "arc",+ innerRadius: undefined,+ },},};@@ -128,6 +132,26 @@ describe("generateAltairChart", () => {`);});+ it("should generate a pie chart when arc has undefined innerRadius", () => {+ const spec = createSpec({+ mark: Mocks.marks.arcDefault,+ encoding: {+ theta: Mocks.thetaAxis,+ },+ });+ const datasource = "df";++ const result = generateAltairChart(spec, datasource).toCode();++ expect(result).toMatchInlineSnapshot(`+ "alt.Chart(df)+ .mark_arc()+ .encode(theta=alt.Theta(field='theta', axis={+ 'title': 'Theta Axis'+ }))"+ `);+ });+it("should generate a donut chart", () => {const spec = createSpec({mark: Mocks.marks.arc,diff --git a/frontend/src/components/data-table/charts/chart-spec/altair-generator.ts b/frontend/src/components/data-table/charts/chart-spec/altair-generator.tsindex 1214cd492f..4d59c703a3 100644--- a/frontend/src/components/data-table/charts/chart-spec/altair-generator.ts+++ b/frontend/src/components/data-table/charts/chart-spec/altair-generator.ts@@ -30,7 +30,10 @@ export function generateAltairChart(if (typeof spec.mark === "object" && "type" in spec.mark) {markProps = Object.fromEntries(Object.entries(spec.mark)- .filter(([key]) => key !== "type")+ .filter(+ ([key, value]) =>+ key !== "type" && value !== undefined && value !== null,+ ).map(([key, value]) => [key, new Literal(value)]),);}