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 uncapped width for datetime charts (#7041)
Shahmir Varqhab0fd6ac5090d
diff --git a/frontend/src/components/data-table/__tests__/__snapshots__/chart-spec-model.test.ts.snap b/frontend/src/components/data-table/__tests__/__snapshots__/chart-spec-model.test.ts.snapindex f397e4f653..6292bf8edf 100644--- a/frontend/src/components/data-table/__tests__/__snapshots__/chart-spec-model.test.ts.snap+++ b/frontend/src/components/data-table/__tests__/__snapshots__/chart-spec-model.test.ts.snap@@ -409,7 +409,7 @@ exports[`ColumnChartSpecModel > should handle datetime bin values 1`] = `},],},- "height": 100,+ "height": 30,"layer": [{"encoding": {@@ -497,6 +497,7 @@ exports[`ColumnChartSpecModel > should handle datetime bin values 1`] = `},},],+ "width": 75,}`;@@ -629,375 +630,6 @@ exports[`ColumnChartSpecModel > should handle string value counts 1`] = `}`;-exports[`ColumnChartSpecModel > snapshot > array 1`] = `-{- "background": "transparent",- "config": {- "axis": {- "domain": false,- },- "view": {- "stroke": "transparent",- },- },- "data": {- "values": [- "a",- "b",- "c",- ],- },- "height": 100,- "layer": [- {- "encoding": {- "x": {- "bin": true,- "field": "a",- "type": "quantitative",- },- "y": {- "aggregate": "count",- "axis": null,- "type": "quantitative",- },- },- "mark": {- "color": "#027864",- "type": "bar",- },- },- {- "encoding": {- "tooltip": [- {- "bin": true,- "field": "a",- "format": ".2f",- "title": "a",- "type": "quantitative",- },- {- "aggregate": "count",- "format": ",d",- "title": "Count",- "type": "quantitative",- },- ],- "x": {- "axis": {- "labelExpr": "(datum.value >= 10000 || datum.value <= -10000) ? format(datum.value, '.2e') : format(datum.value, '.2~f')",- "labelFontSize": 8.5,- "labelOpacity": 0.5,- "title": null,- },- "bin": true,- "field": "a",- "type": "quantitative",- },- "y": {- "aggregate": "max",- "axis": null,- "type": "quantitative",- },- },- "mark": {- "opacity": 0,- "type": "bar",- },- },- ],-}-`;--exports[`ColumnChartSpecModel > snapshot > csv data 1`] = `-{- "background": "transparent",- "config": {- "axis": {- "domain": false,- },- "view": {- "stroke": "transparent",- },- },- "data": {- "values": [- {- "a": 1,- "b": 2,- "c": 3,- },- {- "a": 4,- "b": 5,- "c": 6,- },- ],- },- "height": 100,- "layer": [- {- "encoding": {- "x": {- "bin": true,- "field": "a",- "type": "quantitative",- },- "y": {- "aggregate": "count",- "axis": null,- "type": "quantitative",- },- },- "mark": {- "color": "#027864",- "type": "bar",- },- },- {- "encoding": {- "tooltip": [- {- "bin": true,- "field": "a",- "format": ".2f",- "title": "a",- "type": "quantitative",- },- {- "aggregate": "count",- "format": ",d",- "title": "Count",- "type": "quantitative",- },- ],- "x": {- "axis": {- "labelExpr": "(datum.value >= 10000 || datum.value <= -10000) ? format(datum.value, '.2e') : format(datum.value, '.2~f')",- "labelFontSize": 8.5,- "labelOpacity": 0.5,- "title": null,- },- "bin": true,- "field": "a",- "type": "quantitative",- },- "y": {- "aggregate": "max",- "axis": null,- "type": "quantitative",- },- },- "mark": {- "opacity": 0,- "type": "bar",- },- },- ],-}-`;--exports[`ColumnChartSpecModel > snapshot > csv string 1`] = `-{- "background": "transparent",- "config": {- "axis": {- "domain": false,- },- "view": {- "stroke": "transparent",- },- },- "data": {- "values": [- {- "a": 1,- "b": 2,- "c": 3,- },- {- "a": 4,- "b": 5,- "c": 6,- },- ],- },- "height": 100,- "layer": [- {- "encoding": {- "x": {- "bin": true,- "field": "a",- "type": "quantitative",- },- "y": {- "aggregate": "count",- "axis": null,- "type": "quantitative",- },- },- "mark": {- "color": "#027864",- "type": "bar",- },- },- {- "encoding": {- "tooltip": [- {- "bin": true,- "field": "a",- "format": ".2f",- "title": "a",- "type": "quantitative",- },- {- "aggregate": "count",- "format": ",d",- "title": "Count",- "type": "quantitative",- },- ],- "x": {- "axis": {- "labelExpr": "(datum.value >= 10000 || datum.value <= -10000) ? format(datum.value, '.2e') : format(datum.value, '.2~f')",- "labelFontSize": 8.5,- "labelOpacity": 0.5,- "title": null,- },- "bin": true,- "field": "a",- "type": "quantitative",- },- "y": {- "aggregate": "max",- "axis": null,- "type": "quantitative",- },- },- "mark": {- "opacity": 0,- "type": "bar",- },- },- ],-}-`;--exports[`ColumnChartSpecModel > snapshot > url data 1`] = `-{- "background": "transparent",- "config": {- "axis": {- "domain": false,- },- "view": {- "stroke": "transparent",- },- },- "data": {- "values": [],- },- "height": 100,- "layer": [- {- "encoding": {- "color": {- "condition": {- "test": "datum["bin_maxbins_10_date_range"] === "null"",- "value": "#cc4e00",- },- "value": "#027864",- },- "x": {- "axis": null,- "bin": true,- "field": "date",- "scale": {- "align": 0,- "paddingInner": 0,- "paddingOuter": {- "expr": "length(data('data_0')) == 2 ? 1 : length(data('data_0')) == 3 ? 0.5 : length(data('data_0')) == 4 ? 0 : 0",- },- },- "type": "temporal",- },- "y": {- "aggregate": "count",- "axis": null,- "type": "quantitative",- },- },- "mark": {- "color": "#027864",- "type": "bar",- },- },- {- "encoding": {- "color": {- "condition": {- "test": "datum["bin_maxbins_10_date_range"] === "null"",- "value": "#cc4e00",- },- "value": "#027864",- },- "tooltip": [- {- "bin": {- "binned": true,- },- "field": "bin_maxbins_10_date",- "format": "%Y-%m-%d",- "title": "date (start)",- "type": "temporal",- },- {- "bin": {- "binned": true,- },- "field": "bin_maxbins_10_date_end",- "format": "%Y-%m-%d",- "title": "date (end)",- "type": "temporal",- },- {- "aggregate": "count",- "format": ",d",- "title": "Count",- "type": "quantitative",- },- ],- "x": {- "axis": null,- "bin": true,- "field": "date",- "scale": {- "align": 0,- "paddingInner": 0,- "paddingOuter": {- "expr": "length(data('data_0')) == 2 ? 1 : length(data('data_0')) == 3 ? 0.5 : length(data('data_0')) == 4 ? 0 : 0",- },- },- "type": "temporal",- },- "y": {- "aggregate": "max",- "axis": null,- "type": "quantitative",- },- },- "mark": {- "opacity": 0,- "type": "bar",- },- },- ],-}-`;-exports[`ColumnChartSpecModel > snapshot with legacy data spec > array 1`] = `{"background": "transparent",diff --git a/frontend/src/components/data-table/column-summary/chart-spec-model.tsx b/frontend/src/components/data-table/column-summary/chart-spec-model.tsxindex b7c4f93a53..507c7c79a6 100644--- a/frontend/src/components/data-table/column-summary/chart-spec-model.tsx+++ b/frontend/src/components/data-table/column-summary/chart-spec-model.tsx@@ -198,6 +198,8 @@ export class ColumnChartSpecModel<T> {}const histogram: TopLevelFacetedUnitSpec = {+ width: CONCAT_CHART_WIDTH + CONCAT_NULL_BAR_WIDTH,+ height: CONCAT_CHART_HEIGHT,// @ts-expect-error 'layer' property not in TopLevelFacetedUnitSpeclayer: [{