Skip to content
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
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
"draft-js-import-html": "^1.2.1",
"draft-js-utils": "^1.2.0",
"fast-isnumeric": "^1.1.1",
"immutability-helper": "^2.6.4",
"immutability-helper": "^2.7.1",
"plotly-icons": "latest",
"plotly.js": "1.40.1",
"prop-types": "^15.5.10",
"raf": "^3.4.0",
"react-color": "^2.13.8",
"react-colorscales": "0.6.1",
"react-dropzone": "^4.2.9",
"react-dropzone": "^5.0.1",
"react-plotly.js": "^2.2.0",
"react-rangeslider": "^2.2.0",
"react-resizable-rotatable-draggable": "^0.1.8",
"react-select": "^1.2.0",
"react-select": "^1.3.0",
"react-tabs": "^2.2.1",
"styled-components": "^3.3.3",
"tinycolor2": "^1.4.1"
},
"devDependencies": {
"@percy/react": "^0.4.3",
"autoprefixer": "^7.2.3",
"autoprefixer": "^9.1.3",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.2",
Expand All @@ -43,36 +43,36 @@
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babel-traverse": "^6.26.0",
"css-loader": "^0.28.9",
"cssnano": "^3.10.0",
"css-loader": "^1.0.0",
"cssnano": "^4.1.0",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.4",
"eslint": "^4.12.1",
"eslint-config-prettier": "^2.7.0",
"eslint": "^5.4.0",
"eslint-config-prettier": "^3.0.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-react-percy": "^0.2.1",
"fs": "^0.0.1-security",
"gl": "^4.0.4",
"glob": "^7.1.2",
"jest": "^21.2.1",
"jest-cli": "^22.0.4",
"jest": "^23.5.0",
"jest-cli": "^23.5.0",
"mkdirp": "^0.5.1",
"node-sass": "^4.7.2",
"postcss": "^6.0.14",
"postcss-combine-duplicated-selectors": "^3.1.4",
"postcss-custom-properties": "^6.2.0",
"postcss": "^7.0.2",
"postcss-combine-duplicated-selectors": "^6.0.2",
"postcss-custom-properties": "^7.0.0",
"postcss-remove-root": "^0.0.2",
"prettier": "1.12.1",
"prettier": "1.14.2",
"react": "^16.0.0",
"react-ace": "^5.9.0",
"react-ace": "^6.1.4",
"react-dom": "^16.0.0",
"react-hot-loader": "^4.0.0-beta.21",
"react-inspector": "^2.2.2",
"react-test-renderer": "^16.2.0",
"rimraf": "2.6.2",
"sass-loader": "^6.0.6",
"style-loader": "^0.19.1",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.0",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
},
Expand Down
40 changes: 22 additions & 18 deletions src/components/fields/derived.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,19 @@ export const BinningNumeric = connectToContainer(UnconnectedNumeric, {
export const BinningDropdown = connectToContainer(UnconnectedDropdown, {
modifyPlotProps: (props, context, plotProps) => {
const {localize: _} = context;
plotProps.options =
plotProps.fullContainer.orientation === 'v'
? [
{label: _('Count X'), value: 'count'},
{label: _('Sum Y'), value: 'sum'},
{label: _('Average Y'), value: 'avg'},
{label: _('Minimum Y'), value: 'min'},
{label: _('Maximum Y'), value: 'max'},
]
: [
{label: _('Count Y'), value: 'count'},
{label: _('Sum X'), value: 'sum'},
{label: _('Average X'), value: 'avg'},
{label: _('Minimum X'), value: 'min'},
{label: _('Maximum X'), value: 'max'},
];
const axis =
plotProps.fullContainer.type === 'histogram2d'
? 'Z'
: plotProps.fullContainer.orientation === 'v'
? 'Y'
: 'X';
plotProps.options = [
{label: _('Count ') + axis, value: 'count'},
{label: _('Sum ') + axis, value: 'sum'},
{label: _('Average ') + axis, value: 'avg'},
{label: _('Minimum ') + axis, value: 'min'},
{label: _('Maximum ') + axis, value: 'max'},
];
},
});

Expand All @@ -169,6 +166,13 @@ export const HistogramInfoHorizontal = connectToContainer(Info, {
},
});

export const Histogram2d = connectToContainer(Info, {
modifyPlotProps: (props, context, plotProps) => {
plotProps.isVisible = context.fullContainer.type === 'histogram2d';
return plotProps;
},
});

export const AxesRange = connectToContainer(UnconnectedAxisRangeValue, {
modifyPlotProps: (props, context, plotProps) => {
const {fullContainer} = plotProps;
Expand Down Expand Up @@ -219,12 +223,12 @@ const numericFractionModifyPlotProps = (props, context, plotProps) => {
const min = (attrMeta && attrMeta.min) || 0;
const max = (attrMeta && attrMeta.max) || 1;
if (isNumeric(fullValue)) {
plotProps.fullValue = Math.round(100 * (fullValue - min) / (max - min));
plotProps.fullValue = Math.round((100 * (fullValue - min)) / (max - min));
}

plotProps.updatePlot = v => {
if (isNumeric(v)) {
updatePlot(v / 100 * (max - min) + min);
updatePlot((v / 100) * (max - min) + min);
} else {
updatePlot(v);
}
Expand Down
28 changes: 24 additions & 4 deletions src/default_panels/GraphCreatePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ import {
TraceTypeSection,
LocationSelector,
} from '../components';
import {HistogramInfoVertical, HistogramInfoHorizontal} from '../components/fields/derived';
import {
HistogramInfoVertical,
HistogramInfoHorizontal,
Histogram2d,
} from '../components/fields/derived';

const GraphCreatePanel = (props, {localize: _}) => {
const GraphCreatePanel = (props, {localize: _, setPanel}) => {
return (
<TraceAccordion
canAdd
Expand Down Expand Up @@ -59,11 +63,26 @@ const GraphCreatePanel = (props, {localize: _}) => {
options={[{label: _('Vertical'), value: 'v'}, {label: _('Horizontal'), value: 'h'}]}
/>
<HistogramInfoVertical>
{_('Note: in vertical orientation, X values are used for bins and Y values for weights.')}
{_(
'Note: in vertical orientation, X values are used for binning. If Y values are provided, they are used as inputs to the histogram function which you can configure in the '
)}
<a onClick={() => setPanel('Style', 'Traces')}>{_('Traces')}</a>
{_(' panel. If Y values are omitted, the histogram function defaults to Count.')}
</HistogramInfoVertical>
<HistogramInfoHorizontal>
{_('Note: in horizontal orientation, Y Values are used for bins and X values for weights.')}
{_(
'Note: in horizontal orientation, Y values are used for binning. If X values are provided, they are used as inputs to the histogram function which you can configure in the '
)}
<a onClick={() => setPanel('Style', 'Traces')}>{_('Traces')}</a>
{_(' panel. If X values are omitted, the histogram function defaults to Count.')}
</HistogramInfoHorizontal>
<Histogram2d>
{_(
'Note: X and Y Values are used for binning. If Z values are provided, they are used as inputs to the histogram function which you can configure in the '
)}
<a onClick={() => setPanel('Style', 'Traces')}>{_('Traces')}</a>
{_(' panel. If Z values are omitted, the histogram function defaults to Count.')}
</Histogram2d>
<DataSelector label={_('I (Optional)')} attr="i" />
<DataSelector label={_('J (Optional)')} attr="j" />
<DataSelector label={_('K (Optional)')} attr="k" />
Expand Down Expand Up @@ -132,4 +151,5 @@ const GraphCreatePanel = (props, {localize: _}) => {
export default GraphCreatePanel;
GraphCreatePanel.contextTypes = {
localize: PropTypes.func,
setPanel: PropTypes.func,
};
26 changes: 14 additions & 12 deletions src/default_panels/StyleTracesPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,20 @@ const StyleTracesPanel = (props, {localize: _}) => (
<NumericFraction label={_('Trace Opacity')} attr="opacity" />
<MultiColorPicker label={_('Color')} attr="color" />
<PieColorscalePicker label={_('Colors')} attr="marker.colors" />
<Dropdown
label={_('Histogram Normalization')}
options={[
{label: _('Number of Occurences'), value: ''},
{label: _('Percent'), value: 'percent'},
{label: _('Probability'), value: 'probability'},
{label: _('Density'), value: 'density'},
{label: _('Probability Density'), value: 'probability density'},
]}
attr="histnorm"
/>
<PlotlySection name={_('Values')}>
<BinningDropdown label={_('Histogram Function')} attr="histfunc" />
<Dropdown
label={_('Histogram Normalization')}
options={[
{label: _('Number of Occurences'), value: ''},
{label: _('Percent'), value: 'percent'},
{label: _('Probability'), value: 'probability'},
{label: _('Density'), value: 'density'},
{label: _('Probability Density'), value: 'probability density'},
]}
attr="histnorm"
/>
</PlotlySection>
<PlotlySection name={_('Cumulative')}>
<Radio
label={_('Cumulative')}
Expand Down Expand Up @@ -139,7 +142,6 @@ const StyleTracesPanel = (props, {localize: _}) => (
/>
</PlotlySection>
<PlotlySection name={_('Binning')}>
<BinningDropdown label={_('Binning Function')} attr="histfunc" />
<Radio
label={_('X Binning')}
attr="autobinx"
Expand Down