@@ -23,57 +23,74 @@ export default {
2323 ... this .mutationCounts .windowExpectedMutationCounts ,
2424 ... this .mutationCounts .windowObservedMutationCounts
2525 )
26+ },
27+ traces () {
28+ return [
29+ {
30+ x: this .mutationCounts .windowPositions ,
31+ y: this .mutationCounts .windowObservedMutationCounts ,
32+ name: ' observed'
33+ },
34+ {
35+ x: this .mutationCounts .windowPositions ,
36+ y: this .mutationCounts .windowExpectedMutationCounts ,
37+ name: ' expected'
38+ },
39+ {
40+ type: ' bar' , // https://github.com/plotly/documentation/issues/1270#issuecomment-468645317
41+ x: this .mutationCounts .lollipopsCpGNegativePositions ,
42+ y: this .mutationCounts .lollipopsCpGNegativeHeights ,
43+ width: Array (this .mutationCounts .lollipopsCpGNegativePositions .length ).fill (1 ),
44+ name: ' CpG-'
45+ },
46+ {
47+ type: ' bar' , // https://github.com/plotly/documentation/issues/1270#issuecomment-468645317
48+ x: this .mutationCounts .lollipopsCpGPositivePositions ,
49+ y: this .mutationCounts .lollipopsCpGPositiveHeights ,
50+ width: Array (this .mutationCounts .lollipopsCpGPositivePositions .length ).fill (1 ),
51+ name: ' CpG+'
52+ },
53+ ]
54+ },
55+ layout () {
56+ return {
57+ responsive: true ,
58+ font: {
59+ family: ' Roboto, sans-serif' ,
60+ size: 16
61+ },
62+ // https://codepen.io/plotly/pen/KpLVzv ...
63+ xaxis: {
64+ title: ` Position (bps) along chromosome ${ this .mutationCounts .chromosome } ` ,
65+ showline: true ,
66+ showgrid: false ,
67+ zeroline: false ,
68+ autotick: true ,
69+ showticklabels: true ,
70+ },
71+ yaxis: {
72+ title: ' Number of mutations' ,
73+ showline: true ,
74+ showgrid: false ,
75+ zeroline: false ,
76+ autotick: true ,
77+ showticklabels: true ,
78+ range: [0 , this .yaxisMax ]
79+ },
80+ hovermode: ' closest' ,
81+ hoverlabel: {
82+ bgcolor: ' #fafafa'
83+ },
84+ margin: {
85+ t: 40
86+ }
87+ }
2688 }
2789 },
2890 watch: {
2991 mutationCounts: {
3092 handler : function () {
31- Plotly .react (
32- this .$refs .chart ,
33- [
34- {
35- x: this .mutationCounts .windowPositions ,
36- y: this .mutationCounts .windowObservedMutationCounts ,
37- name: ' observed'
38- },
39- {
40- x: this .mutationCounts .windowPositions ,
41- y: this .mutationCounts .windowExpectedMutationCounts ,
42- name: ' expected'
43- }
44- ],
45- {
46- font: {
47- family: ' Roboto, sans-serif' ,
48- size: 16
49- },
50- // https://codepen.io/plotly/pen/KpLVzv ...
51- xaxis: {
52- title: ` Position (bps) along chromosome ${ this .mutationCounts .chromosome } ` ,
53- showline: true ,
54- showgrid: false ,
55- zeroline: false ,
56- autotick: true ,
57- showticklabels: true ,
58- },
59- yaxis: {
60- title: ' Number of mutations' ,
61- showline: true ,
62- showgrid: false ,
63- zeroline: false ,
64- autotick: true ,
65- showticklabels: true ,
66- range: [0 , this .yaxisMax ]
67- },
68- hovermode: ' closest' ,
69- hoverlabel: {
70- bgcolor: ' #fafafa'
71- },
72- margin: {
73- t: 40
74- }
75- },
76- )
93+ Plotly .react (this .$refs .chart , this .traces , this .layout )
7794 },
7895 deep: true
7996 }
@@ -86,8 +103,8 @@ export default {
86103
87104<style scoped>
88105.plot-container {
89- margin : auto ;
90- width : 800 px ;
106+ margin : 10 px auto ;
107+ width : 1000 px ;
91108 height : 500px ;
92109 background-color : white ;
93110}
0 commit comments