Canvas - scale part of the chartCapture HTML Canvas as gif/jpg/png/pdf?Resize HTML5 canvas to fit windowHow to clear the canvas for redrawingUsing HTML5/Canvas/JavaScript to take in-browser screenshotsAuto Scale TextView Text to Fit within BoundsAndroid GLSurfaceView pinch to zoomEditText scale with selectionHow do I get onTouch events to draw correctly on a zoomable imageview with canvas?Drawing a rectangle behind custom ImageView not animatingZoom in on point in canvas, where everything is based off of a certain point

Two researchers want to work on the same extension to my paper. Who to help?

Are there variations of the regular runtimes of the Big-O-Notation?

What are the components of a legend (in the sense of a tale, not a figure legend)?

Why do Thanos's punches not kill Captain America or at least cause some mortal injuries?

Plastic-on-plastic lubricant that wont leave a residue?

Extrude the faces of a cube symmetrically along XYZ

What is Plautus’s pun about frustum and frustrum?

Early arrival in Australia, early hotel check in not available

Page contents aligning weirdly in LaTeX/Overleaf

Why did the ICC decide not to probe alleged US atrocities in Afghanistan?

How can a Lich look like a human without magic?

Why can't RGB or bicolour LEDs produce a decent yellow?

Why in a Ethernet LAN, a packet sniffer can obtain all packets sent over the LAN?

Anatomically Correct Carnivorous Tree

What does "Ich wusste, dass aus dir mal was wird" mean?

How does Howard Stark know this?

Is the schwa sound consistent?

Why does getw return -1 when trying to read a character?

Why was castling bad for white in this game, and engine strongly prefered trading queens?

Size of a folder with du

What is the significance of 4200 BCE in context of farming replacing foraging in Europe?

Was there ever any real use for a 6800-based Apple I?

How does noise-cancellation work in Mac laptops?

Was this character’s old age look CGI or make-up?



Canvas - scale part of the chart


Capture HTML Canvas as gif/jpg/png/pdf?Resize HTML5 canvas to fit windowHow to clear the canvas for redrawingUsing HTML5/Canvas/JavaScript to take in-browser screenshotsAuto Scale TextView Text to Fit within BoundsAndroid GLSurfaceView pinch to zoomEditText scale with selectionHow do I get onTouch events to draw correctly on a zoomable imageview with canvas?Drawing a rectangle behind custom ImageView not animatingZoom in on point in canvas, where everything is based off of a certain point






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a line chart and a "window" that helps to choose part of the chart to be enlarged by another fragment. Here's what it looks like:



enter image description here



The upper half of screen is intended for the redrawed scaled part of chart from semi-transparent pink window. The "window" itself is a shape described in .xml file. I can drag this shape and in onTouch(View v, MotionEvent event) receive position in pxs of left/right borders. The chart itself is a custom view drawn with drawLines(float[] values, Paint p).



I'm trying to figure out how to infer from which and to which index of float[] values to redraw a scaled chart.



P.S.
I also want to be able to scroll scaled part left and right and zoom with pinch, but that is probably out of the scope of this question.



UPD:

I explained how it can probably be solved in comments










share|improve this question
























  • Before invoking drawLines() I scale my array of points. When moving a "window" shape I can get its left and right position in pixels. Now, I probably want to convert them in original points using the same scale factor. Though, this method will only give me x points and there's no way to get y's. Can I tweak this approach somehow ?

    – pushandpop
    Mar 23 at 12:04

















0















I have a line chart and a "window" that helps to choose part of the chart to be enlarged by another fragment. Here's what it looks like:



enter image description here



The upper half of screen is intended for the redrawed scaled part of chart from semi-transparent pink window. The "window" itself is a shape described in .xml file. I can drag this shape and in onTouch(View v, MotionEvent event) receive position in pxs of left/right borders. The chart itself is a custom view drawn with drawLines(float[] values, Paint p).



I'm trying to figure out how to infer from which and to which index of float[] values to redraw a scaled chart.



P.S.
I also want to be able to scroll scaled part left and right and zoom with pinch, but that is probably out of the scope of this question.



UPD:

I explained how it can probably be solved in comments










share|improve this question
























  • Before invoking drawLines() I scale my array of points. When moving a "window" shape I can get its left and right position in pixels. Now, I probably want to convert them in original points using the same scale factor. Though, this method will only give me x points and there's no way to get y's. Can I tweak this approach somehow ?

    – pushandpop
    Mar 23 at 12:04













0












0








0








I have a line chart and a "window" that helps to choose part of the chart to be enlarged by another fragment. Here's what it looks like:



enter image description here



The upper half of screen is intended for the redrawed scaled part of chart from semi-transparent pink window. The "window" itself is a shape described in .xml file. I can drag this shape and in onTouch(View v, MotionEvent event) receive position in pxs of left/right borders. The chart itself is a custom view drawn with drawLines(float[] values, Paint p).



I'm trying to figure out how to infer from which and to which index of float[] values to redraw a scaled chart.



P.S.
I also want to be able to scroll scaled part left and right and zoom with pinch, but that is probably out of the scope of this question.



UPD:

I explained how it can probably be solved in comments










share|improve this question
















I have a line chart and a "window" that helps to choose part of the chart to be enlarged by another fragment. Here's what it looks like:



enter image description here



The upper half of screen is intended for the redrawed scaled part of chart from semi-transparent pink window. The "window" itself is a shape described in .xml file. I can drag this shape and in onTouch(View v, MotionEvent event) receive position in pxs of left/right borders. The chart itself is a custom view drawn with drawLines(float[] values, Paint p).



I'm trying to figure out how to infer from which and to which index of float[] values to redraw a scaled chart.



P.S.
I also want to be able to scroll scaled part left and right and zoom with pinch, but that is probably out of the scope of this question.



UPD:

I explained how it can probably be solved in comments







java android canvas






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 11:58







pushandpop

















asked Mar 22 at 20:09









pushandpoppushandpop

229718




229718












  • Before invoking drawLines() I scale my array of points. When moving a "window" shape I can get its left and right position in pixels. Now, I probably want to convert them in original points using the same scale factor. Though, this method will only give me x points and there's no way to get y's. Can I tweak this approach somehow ?

    – pushandpop
    Mar 23 at 12:04

















  • Before invoking drawLines() I scale my array of points. When moving a "window" shape I can get its left and right position in pixels. Now, I probably want to convert them in original points using the same scale factor. Though, this method will only give me x points and there's no way to get y's. Can I tweak this approach somehow ?

    – pushandpop
    Mar 23 at 12:04
















Before invoking drawLines() I scale my array of points. When moving a "window" shape I can get its left and right position in pixels. Now, I probably want to convert them in original points using the same scale factor. Though, this method will only give me x points and there's no way to get y's. Can I tweak this approach somehow ?

– pushandpop
Mar 23 at 12:04





Before invoking drawLines() I scale my array of points. When moving a "window" shape I can get its left and right position in pixels. Now, I probably want to convert them in original points using the same scale factor. Though, this method will only give me x points and there's no way to get y's. Can I tweak this approach somehow ?

– pushandpop
Mar 23 at 12:04












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307135%2fcanvas-scale-part-of-the-chart%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307135%2fcanvas-scale-part-of-the-chart%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript