Inkscape.org
Beginners' Questions How to draw and figure a percentage of a distance?
  1. #1
    Cheryll Cheryll @Cheryll

    I wanna do this:

    There is one line, e.g. the increase of the TESLA-Chart. Then there is a correction of the rate.

    How many percent is this correction?

    I want to draw the second line above the correction and Inkscape to give me the amount in percent. Please take a look at the small painting I made.

    The idea is, to have very little clicks to do so.

    Thank you!

     

    Inkscape How To Solve
  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    I would divide the height of the small box by the height of the tall box. (39/86.8=.449, or ~45%)

  3. #3
    brynn brynn @brynn
    *

    Welcome to the forum!

    As I read your message, I would give the same answer as TD.  Except I have a feeling you already know how to calculate a percentage.  And since you don't  need Inkscape to do it, I'm thinking that what you really want to do, has not come out in your message.

    Are you looking for a way for Inkscape to draw the line correctly given the percentage increase?  Or are you looking for Inkscape to display the percentage numbers in text?  Or both?  Or something else that I did not infer?

    Inkscape does not have the ability to draw something based on entered values....unless someone writes an extension, or the user writes a script or uses the commandline.

    Uumm....  There is at least one existing extension which I'm thinking possibly could be used.  Or at least would be good to pattern a new extension after.  Extensions menu > Render > Function Plotter.  So if your lines or angles can be created via mathematical function, possibly that extension might work.  There's another in the same menu, but I don't think it could draw straight lines.  Although I don't know that for a fact.  So you could look at Parametric Curves too.

    Well, that's all assuming I inferred correctly  🙂

    The only extension I know that automatically creates text is for measuring length or area.  One would have to be written to calculate percentage and display the text.  Or else you would have to type the text yourself.

  4. #4
    Cheryll Cheryll @Cheryll

    Thank you for the answers. Thank you for the extension tipps. I will check them. Although I am not too optimistic, because I tried many extensions and there was none, which made me happy.

    What I want to do: I need it for the purpose, what is wrote in my example: Charts. It does not need to work "perfect". It is not the point, if it is 49,3 oder 48 percent. The point is, that sometimes the eye does not see, how far a correction-arm has gone. Somethimes there are so many lines, bars and quotes in a chart, that you trick yourself. After calculating I am suprised of the value and say to myself: oh, really, more than 60 percent already?

    The important thing is, that I do NOT want to caclulate the values, because it is too much work. I would have to read both quotes, to substact them and then figure it out. This takes much time. Instead I want to draw focus to the upward-arm (no matter how long it is in figures) and compare it with the downward-correction arm. Just compare two distances.

    At the moment I use a grid of cells for it: I draw a rectange above the height of the upward arm, copy it by strg+d, drag it away to the downward arm, then I fill it by a grid of 10 lines. These lines I count and know about, which percentage it is. 6 grid lines and a half cell = about 65%. This is a way, but too much work. Additionally I have troubles to convert this grid into a path. I use the developer version 1.1. to do it. But it does not really work fine. My grid is a fuzzy thing. Fills with fading colors, although it should not. Removing the colors often removes the grid as well. Does not convert to a path, although version 1.1. should be able to do. So it is for me only "count once an then lose it". And it takes too many clicks.

  5. #5
    Cheryll Cheryll @Cheryll

    PS: I tried this (it is a German inkscape, so my menu is as well). I did Erweiterungen (=extensions) / Rendern / Funktionsplotter and there I keyed in as function +1/10

    This plots me a line of 10%.

    What I would need is +1/10; +2/10; +3/10... to get a grid. In other words a loop from the zero value to 1. I am not very familiar with Inkscape and far less with extensions. Is there a way to add multiple functions and have them plotted one by one? The result should be a grid written into a rectangle of 10 cells (created by 9 lines within low and high).

    The next tried extension 'grid' draws absolut values, no relative ones into a rectanle, as far as I could see.

     

  6. #6
    Tyler Durden Tyler Durden @TylerDurden

    Maybe you already know... charts can be easily copied from LibreOffice to Inkscape.

    2020 01 13 14 45 35
  7. #7
    Cheryll Cheryll @Cheryll

    Thank you, yes I know this. Never the less your hint shall be in this thread. To add: ctr + c and ctr + v do it as well.

    and to add one more hint: ctr + shift + s open the screenshot-tool. And I prefer the freeware Greenshot. You know, what Greenshot can do for us? On the user defined key ctr+g it shows me a frame to edit above the screen. This frame I drag to my wish-screen-part. Greenshot takes this part, opens inkscape, gives a file a joker-user-defined name and adds the screenshot to this new file.

    All this works fine! Just my percentage idea does not work yet, ;-)

  8. #8
    Tyler Durden Tyler Durden @TylerDurden

    Maybe this?

    I am using Sharex, it is also FOSS.

    Have a nice day.

    TD

  9. #9
    Cheryll Cheryll @Cheryll
    *

    I love it!!

    Thank you. This is not the solution to the current question, but to many others. The developer version has added some possibilities her I was not aware of before your posting, - which really make me happy.

    sharex: Can it start Inkscape?

    The disadvantage of Greenshot is, that it is old. And Sharex has updates every some months. Thanks for the link!

  10. #10
    brynn brynn @brynn
    *

    Aahh.  So I think to understand what you really want, we would need to know what a TESLA-Chart is, and how it's used.  I'm still in the dark as to exactly what you want to do.

    But, it sounds like TD understood enough to give you some helpful info  🙂

    Note that most of us here are Inkscape users.  Inkscape developers, except for a couple, don't usually participate here.  Neither do very many advanced Inkscape users.

    You could try editing your message to include "TESLA-Chart" in the title, and it might attract someone who knows??  Actually as I say that, I'm not positive you can edit your title.  Let me test and I'll be right back.

    Edit

    Alas, indeed titles cannot be edited.  Oh well...  Probably should make a feature request for it....

  11. #11
    Cheryll Cheryll @Cheryll

    Tesla is just the first stock, which came into my mind (I never would buy it): So a TESLA-chat is the quote of the price of the stock displayed on an axis.

    https://de.tradingview.com/symbols/NASDAQ-TSLA/

    Every stock moves in price pushes and corrections. I just want to have a quick idea, how huge the correction is in percent.

  12. #12
    brynn brynn @brynn

    Oooohhh!  Now it starts to come into focus!  (I thought was something about electricity!)

    Is the horizontal distance between points always the same?  Are these existing charts that you want to quickly measure?  Or do you want to also plot the chart?

    I would think there should be some way to do all that with a script.   And there's also the commandline, if it would work better.  (I'm not sure.)  See how TD added the line segment.  Then the script could gather the coordinates and calculate the percentage.  I was just thinking if the horizontal distance is always the same, the math formula might be easier to script.  Then tell Inkscape to create the text.  (I understand the generalities of scripting and programming.  Just no specifics  😛)

    And....  Well I'm not sure if this is true, but I think it is.  If a script could be written to do this, then an Inkscape extension could be made.

  13. #13
    Cheryll Cheryll @Cheryll

    yes, this is true.

    And there is an extension, which would do it. To this: Draw ONE line.

    It is - extensions - render - functions plotter

    To key in +1/10 .... would draw me the first line. The 10% line.

    +2/10 would draw the next line, the 20% line. And so on

    I had a look at this script - and cannot find any code line, which would laugh and me and say "copy me!"

    And how to write the text by script, - aeh -

    This extension would be a great thing. It would allow to measure any distance in percent. I can imagine, quite a lot people would need such a thing.

    This was one way of doing it: Have a look and count the lines by myself. Not the ideal thing. The better thing would be, if Inkscape has this look and counts the lines / figures the relation. How to do this, - at the moment I have no clue.

  14. #14
    Tyler Durden Tyler Durden @TylerDurden

    I don't see the need for this.

    Most financial reporting (media, brokerages) have downloadable charts, or they can be copied from the webpage.

    Most also report the gain/loss compared to the previous closing price.

    The percent day's gain/loss compared to the previous day's gain/loss is easily computed arithmatically without a chart.

     

    Have a nice day.

    TD

     

     

  15. #15
    brynn brynn @brynn
    *

    We have a very basic introductory guide to writing extensions.  https://inkscape.org/develop/extensions/ 

    And a special board in the forum where people can ask for help.  https://inkscape.org/forums/extensions/  

    But you need to be a big "self starter" as the job ads used to say, back in my day (I have no idea what the current lingo is).  In other words, you need to know how to get started on your own.  I think Python is the language you need to know - well, to write an extension.  I don't know if a script in another language would work, outside of an extension.  I have the impression it might, but I don't really know.

    Edit

    Also, you can use existing extensions as a guide to writing yours.  For example, the Visualize Path > Measure Path extension measures a path (or area), and puts the measurement on the canvas in text.  So that would be a good one to see how it works.

  16. #16
    Cheryll Cheryll @Cheryll

    @brynn: thank you so much for the links!

  17. #17
    Tyler Durden Tyler Durden @TylerDurden

    This method provides a ballpark measure of corrections < 100%.

  18. #18
    Cheryll Cheryll @Cheryll

    this looks fantastic, - but I am not able to do this by myself. I am not sure, how to stop your video and where it starts. Thank you for creating it! Never the less, I am overwhelmed.

    I managed to draw some help-grids and to my mind "fill and stroke" shall be my "Füllung und Kontur".

    To where to get the offset field from? (omg inkscape is so mighty!)

    This is what I tried (sorry, does not look too good)

  19. #19
    Tyler Durden Tyler Durden @TylerDurden

    The capture starts when new guides are dragged into the workspace.

    After the guides are placed the rectangle is snapped to 100% height.

    The linear gradient tool (G-key auf Englisch) displays the gradient line from zero to one, and the middle node of the gradient can be dragged to snap to the guideline at the correction level.

     

    Here is the demonstration file.

     

    TD

    Gradient
  20. #20
    Cheryll Cheryll @Cheryll

    thank you for your patience. I am one step further: I have a middle node. But still I have no offset field. And how to do it, that the gradient shows up horizontally instead of vertically?

  21. #21
    Cheryll Cheryll @Cheryll

    screenshot as file

    Clueless 2
  22. #22
    Tyler Durden Tyler Durden @TylerDurden

    The gradient line can be dragged to be vertical and each end snapped to the top and bottom edges of the rectangle. 

    There is no central node in the gradient line shown in your image... double click on the gradient line with the Gradient Tool (g-key) to add one. then, when the central node is selected, the offset value will be shown in the controls bar.

    TD

  23. #23
    Cheryll Cheryll @Cheryll

    yes, I does it! The gradient changed to horicontally and the node is there. And the "offset" (=Versatz in the German version, should anybody on a far day search for it) is there. Thank you so much!

Inkscape Inkscape.org Inkscape Forum Beginners' Questions How to draw and figure a percentage of a distance?