Merge branch 'master' of https://git.ad5001.eu/Ad5001/LogarithmPlotter
This commit is contained in:
commit
d04c5ae52d
3 changed files with 50 additions and 20 deletions
|
@ -107,6 +107,8 @@ ApplicationWindow {
|
|||
yaxisstep: settings.yaxisstep
|
||||
xaxisstep: settings.xaxisstep
|
||||
logscalex: settings.logscalex
|
||||
showxgrad: settings.showxgrad
|
||||
showygrad: settings.showygrad
|
||||
|
||||
onPaint: {
|
||||
var ctx = getContext("2d");
|
||||
|
|
|
@ -39,6 +39,8 @@ Canvas {
|
|||
property string ylabel: ""
|
||||
property int maxgradx: 8
|
||||
property bool logscalex: false
|
||||
property bool showxgrad: false
|
||||
property bool showygrad: false
|
||||
|
||||
property var yaxisstepExpr: (new MathLib.Expression(`x*(${yaxisstep})`))
|
||||
property double yaxisstep1: yaxisstepExpr.execute(1)
|
||||
|
@ -121,6 +123,7 @@ Canvas {
|
|||
ctx.font = "12px sans-serif"
|
||||
|
||||
var txtMinus = ctx.measureText('-').width
|
||||
if(showxgrad) {
|
||||
if(logscalex) {
|
||||
for(var xpow = -maxgradx; xpow <= maxgradx; xpow+=1) {
|
||||
var textSize = ctx.measureText("10"+Utils.textsup(xpow)).width
|
||||
|
@ -136,6 +139,8 @@ Canvas {
|
|||
drawVisibleText(ctx, '-'+txtX, x2px(-drawX)-4, axisxpx+6+textSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(showygrad) {
|
||||
for(var y = 0; y < drawMaxY; y += 1) {
|
||||
var drawY = y*yaxisstep1
|
||||
var txtY = yaxisstepExpr.simplify(y)
|
||||
|
@ -144,6 +149,7 @@ Canvas {
|
|||
if(y != 0)
|
||||
drawVisibleText(ctx, '-'+txtY, axisypx-6-textSize-txtMinus, y2px(-drawY)+4)
|
||||
}
|
||||
}
|
||||
ctx.fillStyle = "#FFFFFF"
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ Column {
|
|||
property string yaxislabel: ""
|
||||
property bool logscalex: true
|
||||
property string saveFilename: ""
|
||||
property bool showxgrad: true
|
||||
property bool showygrad: true
|
||||
|
||||
FileDialog {
|
||||
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 {
|
||||
id: copyToClipboard
|
||||
height: 30
|
||||
|
|
Loading…
Reference in a new issue