Skip to content

Commit

Permalink
Chore/fix histogram tooltips (#324)
Browse files Browse the repository at this point in the history
* fixes "Add tooltips to Histograms" #291
* fixes "Add theming support" #238
* built and released 0.7.10
  • Loading branch information
paddymul authored Oct 31, 2024
1 parent 2fb9fd9 commit da1bf14
Show file tree
Hide file tree
Showing 29 changed files with 2,065 additions and 2,633 deletions.
50 changes: 31 additions & 19 deletions docs/example-notebooks/Styling-Gallery-Pandas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@
"cell_type": "code",
"execution_count": null,
"id": "4",
"metadata": {},
"outputs": [],
"source": [
"BuckarooWidget(obj_df, \n",
" component_config={'className':'asdf', \n",
" 'selectionBackground': 'red'})"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"metadata": {
"tags": []
},
Expand All @@ -122,7 +134,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"id": "6",
"metadata": {
"tags": []
},
Expand All @@ -144,7 +156,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"id": "7",
"metadata": {
"tags": []
},
Expand All @@ -167,7 +179,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"id": "8",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -195,7 +207,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8",
"id": "9",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -225,7 +237,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"id": "10",
"metadata": {
"tags": []
},
Expand All @@ -241,7 +253,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "10",
"id": "11",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -282,7 +294,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"id": "12",
"metadata": {
"tags": []
},
Expand All @@ -294,7 +306,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "12",
"id": "13",
"metadata": {
"tags": []
},
Expand All @@ -310,7 +322,7 @@
},
{
"cell_type": "markdown",
"id": "13",
"id": "14",
"metadata": {},
"source": [
"# Tooltips"
Expand All @@ -319,7 +331,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "14",
"id": "15",
"metadata": {
"tags": []
},
Expand All @@ -339,7 +351,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "15",
"id": "16",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -348,7 +360,7 @@
},
{
"cell_type": "markdown",
"id": "16",
"id": "17",
"metadata": {},
"source": [
"# Color_map_config\n",
Expand Down Expand Up @@ -378,7 +390,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "17",
"id": "18",
"metadata": {
"tags": []
},
Expand All @@ -396,7 +408,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "18",
"id": "19",
"metadata": {
"tags": []
},
Expand All @@ -418,7 +430,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "19",
"id": "20",
"metadata": {
"tags": []
},
Expand All @@ -438,7 +450,7 @@
},
{
"cell_type": "markdown",
"id": "20",
"id": "21",
"metadata": {},
"source": [
"Extra col def type\n",
Expand All @@ -450,7 +462,7 @@
},
{
"cell_type": "markdown",
"id": "21",
"id": "22",
"metadata": {},
"source": [
"# Utility Code"
Expand All @@ -459,7 +471,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "22",
"id": "23",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -525,7 +537,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "23",
"id": "24",
"metadata": {},
"outputs": [],
"source": []
Expand Down
101 changes: 99 additions & 2 deletions docs/examples/ex/ColumnsEditorEx.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,102 @@
import { extraComponents } from 'buckaroo';
import React, {useState} from 'react';
import {extraComponents} from 'buckaroo';
import 'ag-grid-community/styles/ag-grid.css';
import 'ag-grid-community/styles/ag-theme-alpine.css';

export default extraComponents.ColumnsEditorEx;
const sym = extraComponents.utils.sym;
const {
symDf,
CommandConfigT,
CommandArgSpec
} = extraComponents.CommandUtils;

export const EmptyDf: DFWhole = {
dfviewer_config: {
pinned_rows: [],
column_config: []
},
data: []
};

export const bakedArgSpecs: CommandArgSpec = {
dropcol: [null],
fillna: [[3, 'fillVal', 'type', 'integer']],
remove_outliers: [[3, 'tail', 'type', 'float']],
search: [[3, 'needle', 'type', 'string']],
resample: [
[3, 'frequency', 'enum', ['daily', 'weekly', 'monthly']],
[4, 'colMap', 'colEnum', ['null', 'sum', 'mean', 'count']]
]
};

export const bakedOperationDefaults: OperationDefaultArgs = {
dropcol: [sym('dropcol'), symDf, 'col'],
fillna: [sym('fillna'), symDf, 'col', 8],
remove_outliers: [sym('remove_outliers'), symDf, 'col', 0.02],
search: [sym('search'), symDf, 'col', 'term'],
resample: [sym('resample'), symDf, 'col', 'monthly', {}],
};

export const bakedCommandConfig: CommandConfigT = {
argspecs: bakedArgSpecs,
defaultArgs: bakedOperationDefaults,
};

export const bakedOperations: Operation[] = [
[sym('dropcol'), symDf, 'col1'],
[sym('fillna'), symDf, 'col2', 5],
[sym('resample'), symDf, 'month', 'monthly', {}],
];

export const dfviewer_config = {
column_config: [
{
col_name: 'index',
displayer_args: { displayer: 'integer', min_digits: 3, max_digits: 5 },
},
{
col_name: 'svg_column',
displayer_args: { displayer: 'SVGDisplayer' },
},
{
col_name: 'link_column',
displayer_args: { displayer: 'linkify' },
},
{
col_name: 'nanObject',
displayer_args: { displayer: 'integer', min_digits: 3, max_digits: 5 },
color_map_config: {
color_rule: 'color_map',
//map_name: 'DIVERGING_RED_WHITE_BLUE',
map_name: 'BLUE_TO_YELLOW',
val_column: 'tripduration',
},
}],
extra_grid_config: { rowHeight: 105 },
component_config: { height_fraction: 1 },
pinned_rows: [
// { primary_key_val: 'dtype', displayer_args: { displayer: 'obj' } },
// { primary_key_val: 'histogram', displayer_args: { displayer: 'histogram' }, },
]
};


export default function ColumnsEditorEx() {
const [operations, setOperations] = useState(bakedOperations);

const baseOperationResults: OperationResult = {
transformed_df: EmptyDf,
generated_py_code: 'default py code',
transform_error: undefined
};
return (
<extraComponents.ColumnsEditor
df_viewer_config={dfviewer_config}
activeColumn={'foo'}
commandConfig={bakedCommandConfig}
operations={operations}
setOperations={setOperations}
operationResult={baseOperationResults}
/>
);
}
35 changes: 30 additions & 5 deletions docs/examples/ex/CommandViewerEx.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,45 @@
import * as React from 'react';

//import {bakedOperations, bakedCommandConfig } from '../../../js/baked_data/staticData';
import { bakedData } from 'buckaroo';
import { extraComponents } from 'buckaroo';
import {extraComponents} from 'buckaroo';

const sym = extraComponents.utils.sym;
const {
symDf,
CommandConfigT,
CommandArgSpec,
bakedArgSpecs,
} = extraComponents.CommandUtils;

export const bakedOperations: Operation[] = [
[sym('dropcol'), symDf, 'col1'],
[sym('fillna'), symDf, 'col2', 5],
[sym('resample'), symDf, 'month', 'monthly', {}],
];

export const bakedOperationDefaults: OperationDefaultArgs = {
dropcol: [sym('dropcol'), symDf, 'col'],
fillna: [sym('fillna'), symDf, 'col', 8],
remove_outliers: [sym('remove_outliers'), symDf, 'col', 0.02],
search: [sym('search'), symDf, 'col', 'term'],
resample: [sym('resample'), symDf, 'col', 'monthly', {}],
};

export const bakedCommandConfig: CommandConfigT = {
argspecs: bakedArgSpecs,
defaultArgs: bakedOperationDefaults,
};


export default function Simple() {
return (
<extraComponents.OperationViewer
operations={bakedData.bakedOperations}
operations={bakedOperations}
setOperations={(foo: unknown) => {
console.log('setCommands sent', foo);
}}
activeColumn={'foo-column'}
allColumns={['foo-col', 'bar-col', 'baz-col']}
commandConfig={bakedData.bakedCommandConfig}
commandConfig={bakedCommandConfig}
/>
);
}
Loading

0 comments on commit da1bf14

Please sign in to comment.