-
Notifications
You must be signed in to change notification settings - Fork 16
DM-11477 Make plot.ly plotting API to handle Firefly unrecognized charts types cleanly #454
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
…s not interpreted by Firefly
…XY options for chart options side bar.
@@ -44,6 +45,38 @@ export class ScatterToolbar extends SimpleComponent { | |||
} | |||
} | |||
|
|||
function isSelectable(tbl_id, chartId, type) { |
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.
I don't quite understand how we decide that selection box should be present. We might be creating unnecessary complexity here. What if x and y are expressions? I think we should not allow selection box for "unknown chart types".
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.
Yes, we need to determine
- if showing the selection box for 'unknown chart types'?
I had asked the original design intention if showing XY options in case x, y data is defined for 'unknown chart types', and the reply is 'the intention was to exclude XY options from the charts that do not have XY axes', so similarly, should selection box be excluded if the chart which is 'unknown type' but with x, y data? - If not excluded, selection box is shown in case XY is defined and mapped to table columns directly (per discussion with Trey). Selection box could be rendered if x, y is expressions later once we add new columns into the table for the expression.
This is thought that makes the code so far.
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.
The problem is that firefly enhanced charts might be creating the x and y arrays using custom logic bypassing mappings. May be we can check fireflyData.type here: for fireflyHeatmap we do want to support area selection?
Also you can use getColValidator in ColumnOrExpression.jsx to check for column expressions. TableStatsCntlr.getColValStats(tblId) will return table statistics.
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.
Please check ffapi-slate-test2.html, the selection area is not changed for heatmap and scatter cases. (the firefly chart type implemented is not changed). In test2 example, originally scatter chart shows no selection box, and heatmap charts shows the selection box.
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.
The area selection issue for heatmap in ffapi-highlevel-charttest.html is solved by adding table columns info into the state for PlotlyToolBar for the purpose of rerendering the tool bar when the table loading is complete.
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.
Thank you for testing table connection to other chart types and working through the issues.
I noticed that selection box is not present on the toolbar for firefly scatter and heatmap anymore. This needs to be fixed.
Also noticed that boundaries do not seem to work, but this bug must have been introduced earlier.
@@ -236,10 +243,10 @@ const now = Date.now(); | |||
Plotly.Plots.resize(this.div); | |||
break; | |||
case RenderType.UPDATE: | |||
Plotly.update(this.div, data, layout); | |||
Plotly.update(this.div, data, cloneDeep(layout)); |
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.
Why do we need cloneDeep here? I am worried that it will mess optimize
method logic, which checks for the differences between our layout and chart layout. We do expect our layout object to be in sync with the chart's layout.
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.
the layout object gets changed after calling Plotly function for bar chart case and that make the logic confliction in submitChanges of BasicOptions. This happens while calling Plotly.newPlot. We could talk in more detail about this solution.
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.
Cindy added the cloneDeep
because plotly was adding properties to the layout object. It does not treat it as immutable data. If this is a problem the the optimize
then we have a difficult problem. Who can tell us for sure that it is a problem with optimize
?
const noXY = hasNoXY(type, tablesource); | ||
const xColType = noXY ? '' : getColumnType(getTblById(tbl_id), get(tablesource, ['mappings', 'x'], '')); | ||
const yColType = noXY ? '' : getColumnType(getTblById(tbl_id), get(tablesource, ['mappings', 'y'], '')); | ||
const xNoLog = type.includes('histogram') ? true : undefined; // histogram2d or histogram2dcontour |
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.
I don't think noLog option should be here. This was for firefly histogram: since our bin min/max options did not work well when switching to log, we did not want to display log option. For generic XY chart, we should have log option for both axes.
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.
for some cases if the log is checked, the plotly rendering run into some problems.
- if the column is 'string' type
- histogram2d, histrogram2dcontour.
so the chart type and table column type for x & y are considered to be checked, but not sure if this check is needed in case no XY options is shown in the side bar for unknown type chart.
function hasNoXY(type, tablesource) { | ||
if (type.endsWith('3d') || ['pie', 'surface'].includes(type)) return true; | ||
|
||
return (!get(tablesource, ['mappings', 'x']) || !get(tablesource, ['mappings', 'y'])); |
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.
Why do we need to check mappings here? XY options control layout, not data.
In general, I think BasicOptions should not be aware of what is in tablesource beyond tbl_id.
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.
I guess this is a question related to if showing XY options for unknown type chart.
for example, histogram2dcontour has data x, y defined.
pie has no data x, y defined, (it has labels and values)
Please give more thoughts if there is any missing.
Per the comments, please help clarify the following specs.:
|
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.
Loi might have the solution to the cloneDeep
problem. I think you, he and tatiana need to talk. I advised you wrong on the cloneDeep
solution.
@robyww |
related to controlling event propagation when in the the slate view.
… Exclude XY options from the chart options side bar for 'bar' chart.
…firefly into DM-11477-plotlyAPI
Add some updates:
|
This development includes:
download chart as PNG + show/edit filter + chart options and tools + Expand panel (for Pie)
Zoom to the original range + Zoom + Pan (for Histogram, bar, box)
(for 3D-like charts, such as scatter3d, surface, mesh3d)
update the logic for XY options, XY range, marker color, etc.
Test:
run demo/ffapi-slate-test3.html to get the following chart samples:
histogram, surface, bar, pie, histogram2dcontour and box.
The chart samples are made for showing purpose with no significant meanings.