Commit 8ca8b534 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Fixed thermal property range to 0-600K (old behaviour), fixed issue with band...

Fixed thermal property range to 0-600K (old behaviour), fixed issue with band structure plot segment labeling.
parent d033b5e2
Pipeline #85587 skipped with stage
This diff is collapsed.
......@@ -99,7 +99,7 @@ class PlotterBase{
while(this.yMax*i > this.yMin) {
svg.addLine(this.plotArea, 0, this.transformY(this.yMax*i), -3, this.transformY(this.yMax*i), 1);
let temp = this.yMax*i;
let numberText = Math.abs(temp) >= 10000 ? temp.toExponential() : temp.toFixed(decimals);
let numberText = Math.abs(temp) >= 10000 ? temp.toExponential(decimals) : temp.toFixed(decimals);
svg.addText(this.plotArea, -5, this.transformY(this.yMax*i)+3, numberText,
'end', 'statisticsviewersteps');
i--;
......@@ -111,9 +111,9 @@ class PlotterBase{
for (let i = 0; i <= ySteps; i++) {
svg.addLine(this.plotArea, 0, -yStep*i, -3, -yStep*i, 1);
let numberToPaint= (yStep*i/this.yRel) + this.yMin;
// Fix to prevent the -0 printing
numberToPaint = Math.abs(numberToPaint) >= 10000 ? numberToPaint.toExponential(decimals) : numberToPaint.toFixed(decimals);
if (Math.abs(numberToPaint) < 0.01) numberToPaint = 0;
svg.addText(this.plotArea,-5, -(yStep*i-3), numberToPaint.toFixed(decimals), 'end', 'statisticsviewersteps');
svg.addText(this.plotArea,-5, -(yStep*i-3), numberToPaint, 'end', 'statisticsviewersteps');
}
}
......
......@@ -138,9 +138,9 @@ class BSPlotter extends InteractivePlotterBase {
let kPathDistances = segment.k_path_distances;
this.bandsDataSpin1.push([]); // Add a new array per segment
this.bandsDataSpin2.push([]);
let segmentDistance = kPathDistances[kPathDistances.length - 1];
let segmentDistance = kPathDistances[kPathDistances.length - 1] - kPathDistances[0];
// keeping the segment limits (x coordenate) for after painting
// keeping the segment limits (x coordinate) for after painting
this.segmentLimitsX.push(currentDistance/totalDistance);
if (labels !== null){
......@@ -149,7 +149,7 @@ class BSPlotter extends InteractivePlotterBase {
this.drawKPointLabel(currentDistance/totalDistance,
getSymbol(prevLastLabel)+'|'+getSymbol(labels[0]));
else
this.drawKPointLabel(currentDistance/totalDistance,getSymbol(labels[0]));
this.drawKPointLabel(currentDistance/totalDistance, getSymbol(labels[0]));
// The last label
if (k === bandStructData.length -1)
this.drawKPointLabel(1, getSymbol(labels[1]));
......
......@@ -51,9 +51,24 @@ class HeatCapPlotter extends PlotterBase{
}
}
// We only display values up to 600K
let maxIndex;
for (let i=0; i < x.length; ++i) {
let ival = x[i];
if (ival > 600) {
maxIndex = i-1;
break
}
}
if (maxIndex === undefined) {
maxIndex = x.length - 1;
}
x = x.slice(0, maxIndex+1);
y = y.slice(0, maxIndex+1);
let yMaxValue = Math.max.apply(null, y);
let yAxisMaxValue = Math.ceil(yMaxValue/200)*200;
let xMaxValue = Math.max.apply(null, x);
let xMaxValue = x[maxIndex];
let xAxisMaxValue = Math.ceil(xMaxValue/50)*50;
this.setRangeAndLabels('T (K)', 0, xAxisMaxValue, 'Cv (J/K/kg)', 0, yAxisMaxValue);
this.drawAxis(4, 4, 0);
......
......@@ -30,7 +30,7 @@ let PlotterBase = require('../common/PlotterBase.js');
class HelmholtzPlotter extends PlotterBase {
constructor() {
super({left: 60, right: 16, top: 10, bottom: 32});
super({left: 70, right: 16, top: 10, bottom: 32});
this.tooltip;
}
......@@ -49,15 +49,32 @@ class HelmholtzPlotter extends PlotterBase {
yClean.push(yi);
}
}
// We only display values up to 600K
let maxIndex;
for (let i=0; i < x.length; ++i) {
let ival = x[i];
if (ival > 600) {
maxIndex = i-1;
break
}
}
if (maxIndex === undefined) {
maxIndex = x.length - 1;
}
x = x.slice(0, maxIndex+1);
y = y.slice(0, maxIndex+1);
let yMaxValue = Math.max.apply(null, y);
let yMinValue = Math.min.apply(null, y);
let yAxisMaxValue = Math.ceil(yMaxValue/1000)*1000;
let yAxisMinValue = Math.floor(yMinValue/1000)*1000;
let xMaxValue = Math.max.apply(null, x);
let yAxisMaxValue = Math.ceil(yMaxValue/5000)*5000;
let yAxisMinValue = Math.floor(yMinValue/5000)*5000;
let xMaxValue = x[maxIndex];
let xAxisMaxValue = Math.floor(xMaxValue/50)*50;
this.setRangeAndLabels('T (K)', 0, xAxisMaxValue, 'F (J/kg)', yAxisMinValue, yAxisMaxValue);
this.drawAxis(4, null, 0);
this.drawAxis(4, 4, 2);
let polylinePoints = '';
x.forEach( (t, i) => {
......
Supports Markdown
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