Display/Hide scales (not saved yet)
This commit is contained in:
parent
6d1c3d5450
commit
018ad08348
3 changed files with 50 additions and 20 deletions
|
@ -107,6 +107,8 @@ ApplicationWindow {
|
||||||
yaxisstep: settings.yaxisstep
|
yaxisstep: settings.yaxisstep
|
||||||
xaxisstep: settings.xaxisstep
|
xaxisstep: settings.xaxisstep
|
||||||
logscalex: settings.logscalex
|
logscalex: settings.logscalex
|
||||||
|
showxgrad: settings.showxgrad
|
||||||
|
showygrad: settings.showygrad
|
||||||
|
|
||||||
onPaint: {
|
onPaint: {
|
||||||
var ctx = getContext("2d");
|
var ctx = getContext("2d");
|
||||||
|
|
|
@ -39,6 +39,8 @@ Canvas {
|
||||||
property string ylabel: ""
|
property string ylabel: ""
|
||||||
property int maxgradx: 8
|
property int maxgradx: 8
|
||||||
property bool logscalex: false
|
property bool logscalex: false
|
||||||
|
property bool showxgrad: false
|
||||||
|
property bool showygrad: false
|
||||||
|
|
||||||
property var yaxisstepExpr: (new MathLib.Expression(`x*(${yaxisstep})`))
|
property var yaxisstepExpr: (new MathLib.Expression(`x*(${yaxisstep})`))
|
||||||
property double yaxisstep1: yaxisstepExpr.execute(1)
|
property double yaxisstep1: yaxisstepExpr.execute(1)
|
||||||
|
@ -121,6 +123,7 @@ Canvas {
|
||||||
ctx.font = "12px sans-serif"
|
ctx.font = "12px sans-serif"
|
||||||
|
|
||||||
var txtMinus = ctx.measureText('-').width
|
var txtMinus = ctx.measureText('-').width
|
||||||
|
if(showxgrad) {
|
||||||
if(logscalex) {
|
if(logscalex) {
|
||||||
for(var xpow = -maxgradx; xpow <= maxgradx; xpow+=1) {
|
for(var xpow = -maxgradx; xpow <= maxgradx; xpow+=1) {
|
||||||
var textSize = ctx.measureText("10"+Utils.textsup(xpow)).width
|
var textSize = ctx.measureText("10"+Utils.textsup(xpow)).width
|
||||||
|
@ -136,6 +139,8 @@ Canvas {
|
||||||
drawVisibleText(ctx, '-'+txtX, x2px(-drawX)-4, axisxpx+6+textSize)
|
drawVisibleText(ctx, '-'+txtX, x2px(-drawX)-4, axisxpx+6+textSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(showygrad) {
|
||||||
for(var y = 0; y < drawMaxY; y += 1) {
|
for(var y = 0; y < drawMaxY; y += 1) {
|
||||||
var drawY = y*yaxisstep1
|
var drawY = y*yaxisstep1
|
||||||
var txtY = yaxisstepExpr.simplify(y)
|
var txtY = yaxisstepExpr.simplify(y)
|
||||||
|
@ -144,6 +149,7 @@ Canvas {
|
||||||
if(y != 0)
|
if(y != 0)
|
||||||
drawVisibleText(ctx, '-'+txtY, axisypx-6-textSize-txtMinus, y2px(-drawY)+4)
|
drawVisibleText(ctx, '-'+txtY, axisypx-6-textSize-txtMinus, y2px(-drawY)+4)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ctx.fillStyle = "#FFFFFF"
|
ctx.fillStyle = "#FFFFFF"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ Column {
|
||||||
property string yaxislabel: ""
|
property string yaxislabel: ""
|
||||||
property bool logscalex: true
|
property bool logscalex: true
|
||||||
property string saveFilename: ""
|
property string saveFilename: ""
|
||||||
|
property bool showxgrad: true
|
||||||
|
property bool showygrad: true
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: fdiag
|
id: fdiag
|
||||||
|
@ -199,6 +201,26 @@ Column {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: showXGrad
|
||||||
|
checked: settings.showxgrad
|
||||||
|
text: 'Show X graduation'
|
||||||
|
onClicked: {
|
||||||
|
settings.showxgrad = checked
|
||||||
|
settings.changed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: showYGrad
|
||||||
|
checked: settings.showygrad
|
||||||
|
text: 'Show Y graduation'
|
||||||
|
onClicked: {
|
||||||
|
settings.showygrad = checked
|
||||||
|
settings.changed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: copyToClipboard
|
id: copyToClipboard
|
||||||
height: 30
|
height: 30
|
||||||
|
|
Loading…
Reference in a new issue