Commit 441bb5f8 authored by Iker Hurtado's avatar Iker Hurtado
Browse files

Y axis labels improvement in combined electronic structure diagrams (Issue 97)

parent 4fc694a4
Pipeline #31642 passed with stages
in 5 seconds
......@@ -3842,6 +3842,16 @@
}
setExternalYAxisMax(externalYAxisMax){
this.externalYAxisMax = externalYAxisMax;
}
getYAxisMax(){
return this.yAxisMax;
}
repaint(){
// repaint Y axis
this._resetYAxisLabelGroup();
......@@ -3852,6 +3862,8 @@
let min = Math.floor(this.yMin/yLabelGap)*yLabelGap;
let max = Math.ceil(this.yMax/yLabelGap)*yLabelGap;
this.yAxisMax = max;
if (this.externalYAxisMax !== undefined) max = this.externalYAxisMax;
if (this.yLabelText !== null) {
for (let i = min; i < max+1; i = i + yLabelGap) {
......@@ -6285,7 +6297,7 @@
*/
/*
Implements a graphical UI component composed of a DOS plotter and a
Implements a graphical UI component composed of a DOS plotter and a
Band Structure plotter
*/
......@@ -6357,6 +6369,8 @@
this.dosPlotter.setPoints(dosData, codeName);
if (this.hasDispData){
this.bsPlotter.setExternalYAxisMax(this.dosPlotter.getYAxisMax());
this.dosPlotter.setRepaintListener( (yZoom, yOffset) => {
this.bsPlotter.setYZoomAndOffset(yZoom, yOffset);
this.bsPlotter.repaint();
......
......@@ -181,6 +181,16 @@ class InteractivePlotterBase{
}
setExternalYAxisMax(externalYAxisMax){
this.externalYAxisMax = externalYAxisMax;
}
getYAxisMax(){
return this.yAxisMax;
}
repaint(){
// repaint Y axis
this._resetYAxisLabelGroup();
......@@ -191,6 +201,8 @@ class InteractivePlotterBase{
let min = Math.floor(this.yMin/yLabelGap)*yLabelGap;
let max = Math.ceil(this.yMax/yLabelGap)*yLabelGap;
this.yAxisMax = max;
if (this.externalYAxisMax !== undefined) max = this.externalYAxisMax;
if (this.yLabelText !== null) {
for (let i = min; i < max+1; i = i + yLabelGap) {
......
......@@ -17,7 +17,7 @@
*/
/*
Implements a graphical UI component composed of a DOS plotter and a
Implements a graphical UI component composed of a DOS plotter and a
Band Structure plotter
*/
......@@ -89,6 +89,8 @@ class BSDOSPlotter{
this.dosPlotter.setPoints(dosData, codeName);
if (this.hasDispData){
this.bsPlotter.setExternalYAxisMax(this.dosPlotter.getYAxisMax());
this.dosPlotter.setRepaintListener( (yZoom, yOffset) => {
this.bsPlotter.setYZoomAndOffset(yZoom, yOffset);
this.bsPlotter.repaint();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment