-
Notifications
You must be signed in to change notification settings - Fork 16
DM-8302 options for opposite axis location: X on top, Y on right #265
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
Conversation
Also refactored code to separate ColumnOrExpression field to use in histogram.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. I tried it on multiple browsers and it was working fine. I made several comments in code, but they are only questions or comment and does not need to be changed.
Unrelated to this pull request, I noticed that histogram chart does not have a line border on the y-axis label.
let doUpdate = false; | ||
if (height !== nextProps.height || width !== nextProps.width ) { | ||
chart.setSize(nextProps.width, nextProps.height, false); | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function is a bit confusing to me. beside returning should update, it also does a chart.redraw.
but here, a setSize() does not need to be redrawn?
} | ||
if (doUpdate) { chart.redraw(false); } | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this return false statement should be moved outside of the if(chart) block.
}; | ||
|
||
|
||
// when more than one histogram is defined use series | ||
Histogram.propTypes = { | ||
series: PropTypes.arrayOf(PropTypes.object), // array of objects with data, binColor, and name properties | ||
xAxis: PropTypes.object, | ||
yAxis: PropTypes.object, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be useful if you made this a shape type with defined props. just a thought. I am not sure how useful it is.
@@ -22,7 +22,7 @@ export const axisParamsShape = PropTypes.shape({ | |||
label : PropTypes.string, | |||
unit : PropTypes.string, | |||
error: PropTypes.string, | |||
options : PropTypes.string // ex. 'grid,log,flip' | |||
options : PropTypes.string // ex. 'grid,log,flip,opposite' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use oneOf here?
Regarding the first comment. Highcharts separate redraw and reflow. Reflow
happens automatically on container resize, it's more efficient than redraw.
But you are right that return should not be there, because other props can
change too.
…------------------------------
In src/firefly/js/charts/ui/Histogram.jsx
<#265 (review)>
:
> const chart = this.refs.chart && this.refs.chart.getChart();
if (chart) {
- let doUpdate = false;
- if (height !== nextProps.height || width !== nextProps.width ) {
- chart.setSize(nextProps.width, nextProps.height, false);
- return false;
- }
+ try {
+ let doUpdate = false;
+ if (height !== nextProps.height || width !== nextProps.width ) {
+ chart.setSize(nextProps.width, nextProps.height, false);
+ return false;
this function is a bit confusing to me. beside returning should update, it
also does a chart.redraw.
but here, a setSize() does not need to be redrawn?
|
In src/firefly/js/charts/ui/Histogram.jsx <#265 (review)>:
> };
// when more than one histogram is defined use series
Histogram.propTypes = {
series: PropTypes.arrayOf(PropTypes.object), // array of objects with data, binColor, and name properties
+ xAxis: PropTypes.object,
+ yAxis: PropTypes.object,
It may be useful if you made this a shape type with defined props. just a
thought. I am not sure how useful it is.
I was hoping that xAxis and yAxis can hold any relevant Highcharts option.
For now, we pass "reversed" and "opposite", but if you use a component
directly as in
http://localhost:8080/firefly/demo/ffapi-highlevel-charttest.html, you can
supply any option for xAxis or yAxis via these properties.
I am still not sure what would be the best way to supply random Highcharts
properties. If we allow to pass the whole config, how do we map series to
the data? We create series dynamically, based on parameters. In addition
to data, there could be error series, selected points series, a highlight.
How do we give user an ability to tweak options for each of those?
|
Separated reversed and opposite ("top" for X, "right" for Y) axis options.
Refactored code to use ColumnOrExpression field in histogram or other charts.
https://jira.lsstcorp.org/browse/DM-8302
To test, open chart options and play with axis options in collapsible for X or Y axes.