4
Guys, here’s the thing, I’m doing it with js
+ html5
and canvas
a program to plot graphics:
I would like to implement a zoom + and -, as in the image, and return to the original zoom by clicking '='.
My difficulty is the following: after zooming in, the Cartesian axes 'x' and 'y' have to change their values is not ?
Example: http://jsxgraph.uni-bayreuth.de/wp/examples/, after pressing the '+' button the values of the axes change, another example is the google chart, after zooming the values of the axes change.
I wanted more or less this, I wanted the idea of how to do this, change the values of the axes according to the zoom, or ready-made examples, or some similar solution!!!
I was going through the documentation of
canvas
when I came across the propertyctx.scale(2, 2)
, I believe you can work with her– MarceloBoni
Here is an answer to your question: http://answall.com/a/61161/14262
– MarceloBoni
@Marcelobonifazio, that’s not what I want, I think Oce got it wrong, this zoom effect and Cale I already have, it’s working perfectly, what I want is, that after increasing the zoom or Scale (whatever) the values of the axes change, as in the example here: http://prntscr.com/7wh9dt after zooming in, the remaining axes changed the value http://prntscr.com/7wh9jt, and so on and so on, what I want is this.
– Fillipe
I don’t think there’s any need to do this, but you can use the scale value to apply to each x and y this way:
novoX = valorDaEscala + x
;novoY = valorDaEscala + y
– MarceloBoni
I don’t know if I’d apply that very well, because my scale already starts at 50, how would that look? And at each click Scale is acrestado + 25, that is, it starts with 50, then 75 after 100 after 125...(considering what I’m clicking on '+'. I didn’t understand very well what you meant; Lemrando that, what is modified at each click is the scale, not the zoom, the zoom is always fixed,
– Fillipe
Discard my last comment! I did not understand how the axis modifications would look according to the click, because my initial scale is 1, that is, ctx.Scale(1,1), this value is fixed, never changes. What I change with each click is the function 'line' scale, only the function 'line' is changed to its scale, not the whole screen. http://www.w3schools.com/tags/canvas_scale.asp ): notice that when the scale increases, the border of the tmb line changes, so it would be very 'scrotum' to increase the Scale of the whole screen, so I have a Scale variable, which determines the Scale only of the line of my function
– Fillipe