-
Notifications
You must be signed in to change notification settings - Fork 69
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
Integrate Plotly JavaScript for Job Viewer Tab #1729
Conversation
…peers and fixes rendering of envelope plots.
…also fixed some tooltip inconsistencies with Gantt Chart and Timeseries charts compared to production.
…er functionality.
…peers and fixes rendering of envelope plots.
…also fixed some tooltip inconsistencies with Gantt Chart and Timeseries charts compared to production.
…er functionality.
…error message format.
@@ -20,7 +20,7 @@ const args = require('yargs').argv; | |||
|
|||
await page.goto('file://' + args['input-file']); | |||
|
|||
const innerHtml = await page.evaluate(() => document.querySelector('.highcharts-container').innerHTML); | |||
const innerHtml = await page.evaluate(() => document.querySelector('.plotly').innerHTML); |
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.
You can't change this - it will break image export for the rest of XDMoD.
), | ||
|
||
'text' => $settings['show_title'] ? $data['schema']['description'] : null | ||
) | ||
); | ||
|
||
if (strpos($data['schema']['units'], '%') !== false) { | ||
/*if (strpos($data['schema']['units'], '%') !== 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.
Please don't add commented code - I'm sure the linter has already complained about this!
"y": 1.2 | ||
} | ||
] | ||
console.log("new annontation"); |
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 don't add console.log() statements (by all means use them when debugging - but not in the final code that gets reviewed).
}, // resize | ||
|
||
destroy: function () { | ||
/* |
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.
What is the new object lifecycle? Before we explicitly called destroy on highcharts charts to free up memory when the tab was closed. How does it work now in your code?
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.
Plotly.purge(graphDiv)
is supposed to be called here. I will add that to destroy.
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.
Just a couple of questions
break; | ||
} | ||
} | ||
|
||
$axisTitleFontSize = ($settings['font_size'] + 12) . 'px'; |
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.
How come this code was left in but the rest of the setting transformation code was moved? Is there something different about the axis font sizes?
this.chart = new Highcharts.Chart(this.chartOptions); | ||
|
||
render: function () { | ||
this.chart = Plotly.newPlot(this.id, [], this._DEFAULT_CONFIG.layout, this._DEFAULT_CONFIG.config); |
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.
Does it cause problems passing the same configuration objects to multiple plotly instances? I naively would have done a deep copy on the DEFAULT_CONFIG objects and then passed the copy into the plotly instance.
showarrow: false | ||
} | ||
]; | ||
this._DEFAULT_CONFIG.layout.annotations = errorText; |
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 it is a good idea to be editing the DEFAULT_CONFIG object. it can hardly be a portal-wide default if it changes accordiong to the state of an individual chart
var trace = {}; | ||
if (data.error === '') { | ||
var chartColor = this._getDataColor(data.value); | ||
this._DEFAULT_CONFIG.layout.plot_bgcolor = chartColor.bg_color; |
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.
Same comment as above - not a good idea to edit the default that is shared among all charts.
…ghcharts comments/code.
…fault value inside function block.
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.
LGTM. I"m good to merge once Joe has a look.
) { | ||
$effectiveWidth = (int)($width*$scale); | ||
$effectiveHeight = (int)($height*$scale); | ||
|
||
$html_dir = __DIR__ . "/../html"; | ||
$template = file_get_contents($html_dir . "/highchart_template.html"); | ||
if ($isPlotly){ |
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.
Very minor point: if the chart is plotly then the code will open the file called highchart_template.html then allocate memory, then copy the contents of the file into memory, then delete the memory. Needless to say there is no point using cpu cycles to read the highchart_template file when in plotly mode.
Don't need to change this for this pull request. But should address this in the next set of code changes.
Description
Timeseries Charts:
Analytic Charts:
Peer Charts (Gantt Charts):
Timeseries Drilldown:
plotly_click
inChartPanel.js
to grab the nodeid of the trace's data point selected for drilldown redirect.GanttChart.js
to include the click event information in each data point and then whenplotly_click
firesaction: 'show'
is added to the click event info and is encoded for the drilldown redirect.Export:
chrome-helper.js
to the div inplotly_template.html
chartImageResponse()
inclasses/Rest/Controller/WarehouseControllerProvider.php
charting.php
to grab file content fromplotly_template.html
plotly_template.html
. Uses layout and data given fromcharting.php
to draw chart a div.Known Issues/TODO
plotly_hover
andplotly_unhover
that mimics highcharts point hover events. Currently, not included with the PR but during testing the events crashed the webpage if hovering over charts with many overlapping traces. Note: this issue may be included in a future PR as it does not impact functionalityMotivation and Context
Currently, Highcharts requires a license to be purchased which is solved by using Plotly js an open-source library.
Tests performed
xdmod-supremm
for changes made to Job ViewerTODO
Checklist: