Integrate chart to scalar with Vue#268
Integrate chart to scalar with Vue#268nickyfantasy merged 5 commits intoPaddlePaddle:migrateFromSanToVuefrom
Conversation
* use default prop instead of duplicate data and prop * use function instead of shorthand declaration with data
| </v-btn> | ||
| <v-select | ||
| v-if="downloadLink" | ||
| style="width:100px;" |
There was a problem hiding this comment.
If you have a fixed value, why not putting it in css
There was a problem hiding this comment.
coz of laziness
| }, | ||
| data() { | ||
| return { | ||
| width: 400, |
There was a problem hiding this comment.
Why are these stored as component data? Unless this changes (which we don't have right now right?), this should probably not be computed
There was a problem hiding this comment.
Storing width and height in the data seems fine.
There was a problem hiding this comment.
I think they put it here because user can expand/shrink the chart
frontend/src/scalars/ui/Chart.vue
Outdated
| ); | ||
| seriesOption = flatten(seriesOption); | ||
| let legendOptions = tagList.map(item => item.run); | ||
| let that = this; |
There was a problem hiding this comment.
let view = this; Who came up with that
There was a problem hiding this comment.
lol, I coped all these from original san files, we actually do not need a local variable at all, just use this. for the rest of context
| }; | ||
| return getPluginScalarsScalars(params); | ||
| }); | ||
| axios.all(requestList).then(resArray => { |
There was a problem hiding this comment.
Requests should probably not be made from within component. Can you move this to a service / API manager outside?
| }, | ||
|
|
||
| expandArea() { | ||
| let pageBoxWidth = document.getElementsByClassName('visual-dl-chart-page-box')[0].offsetWidth; |
There was a problem hiding this comment.
You should be using something like refs to find elements rendered by this component, instead of DOM query selector lookups.
https://vuejs.org/v2/guide/components.html#Child-Component-Refs
There was a problem hiding this comment.
very good idea. ref is the way to go, I will replace all document.getElementsBy... with ref. However in this case it is finding the parent component element...let me see if there is a way to do it
frontend/src/scalars/Scalars.vue
Outdated
| import autoAdjustHeight from '../common/util/autoAdjustHeight'; | ||
|
|
||
| import Config from './ui/config' | ||
| import Config from './ui/Config.vue' |
There was a problem hiding this comment.
You can also do import ui-config from './ui/Config.vue'
and simply do components: {
ui-config
}
There was a problem hiding this comment.
hmm...compiler complains when I do import ui-config, "-" is not allowed in this case
| }, | ||
| filteredConfig() { | ||
| let tansformArr = ['downloadLink', 'outlier']; | ||
| let transformArr = ['downloadLink', 'outlier']; |
frontend/src/scalars/ui/Chart.vue
Outdated
| const intervalTime = 15; | ||
|
|
||
| export default { | ||
| components: { |
There was a problem hiding this comment.
If we don't plan to include any component, let's remove the components for now.
| }, | ||
| data() { | ||
| return { | ||
| width: 400, |
There was a problem hiding this comment.
Storing width and height in the data seems fine.
| horizontal: function(val) { | ||
| this.setChartHorizon(); | ||
| }, | ||
| // runs: function(val) { |
There was a problem hiding this comment.
Why is this commented out?
There was a problem hiding this comment.
They did not define setChartsRuns(line 102) in anywhere. But I expect they add this for future purpose, so I comment it for now.
| </template> | ||
| <script> | ||
| // import ExpandPanel from '../../common/component/ExpandPanel'; | ||
| import Chart from './Chart.vue'; |
There was a problem hiding this comment.
I think it is possible to import without adding .vue
| @@ -1,26 +1,26 @@ | |||
| <template> | |||
There was a problem hiding this comment.
Is there a particular reason for the renaming?
There was a problem hiding this comment.
Looks like Vue coding standard Component name starts with capital
| <v-slider label="Smoothing" v-bind:max="100" v-bind:min="0" v-model="config.smoothing" dark></v-slider> | ||
| <v-text-field v-model="config.smoothing" type="number" dark></v-text-field> | ||
| <div> | ||
| <v-slider label="Smoothing" :max="0.999" :min="0" :step="0.001" v-model="config.smoothing" dark></v-slider> |
There was a problem hiding this comment.
Does v-slider take step smaller than 1? I thought it only take Integer number
There was a problem hiding this comment.
v-slider takes type Number which can be double or integer
* Initial checking to setup Vue basic requirements. (#264) Add App.vue Add AppMenu.vue * Vue with app menu (#265) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add major components (#266) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add Scalars, Images, Histograms, Graph. * Switch to use the stylus language for CSS * Port functions from Scalars.san to Scalars.vue * Add config vue (#267) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add Config Vue * Integrate chart to scalar with Vue (#268) * Fix warnings from Vue compiler * use default prop instead of duplicate data and prop * use function instead of shorthand declaration with data * refract naming style, fix scalar options * Fix config UI * Add chart and chart page and integrate to scalar * update with varun and jeff's comments * Add images config (#270) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add the Config.vue for Images * Add the CharPage.vue and Image.vue * Hook up the config to the image.vue so that the image height and width can update * Show Scalar Data and add ExpandPanel (#272) * Watch tagInfo changes to update chart and fix tooltip issue * Add expand panel and maintain isShow state in the panel * Add Expand Panel in Image * Add watch group name reg (#273) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add Watch on the groupNameReg * Allow the nav bar to persist the selected item style. (#274) * Fix the incorrect pagination issue. (#276) * Add the Graph.vue and the Config.vue for Graph tab (#277) * Add the Histogram related vue files. (#278) * Fix error message on charts (#279) * Make sure to clear the chart before each use. * Add key for v-for loop. * Add theme and fix UI (#280) -Apply theme color in Vuetify -Add main.styl to override Vuetify default stylus variables -Add relative path in web pack config to find variables.styl * Fix multiple scalar issues: (#283) * Fix multiple scalar issues: -download link / outliers should take boolean value instead of array -download link now show proper selector of runsItem and download button -Use tag as key to prevent chart re-rendering -Add missing label in scalar config and fix UI * simply use index for key because scalar has different tag info structure from image and histogram * Fix font size and reorganize css and stylus (#287) * Fix comments * placeholder index.js * Fix issue where download data link points to empty run (#294) -Dropdown should only display non empty runs -Select first run by default -Remove drop down if all are empty runs -Refract download type to runItemForDownload -Add train run and multiple tags in mock data * Fix error when scalar data empty (#298) -Error comes in when trying to access elements inside empty data -When one of the runs has empty data, the chart will display nothing even other run has non empty data -Fix by checking length of data before accessing
No description provided.