There is probably a very simple solution for this:
I have this text object:
pointDisp = display.newText("Score: "..score, 30, 20, native.systemFont, 30)
Occasionally, I change the text. Sometimes score is 0, sometimes score is 10000. I would like the text to expand to the right and always start at x-position 30, but when the text includes a lot of characters, the text expands and moves outwards in both directions (even though the x-position for the object remains 30).
Can anyone help?
From the Corona documentation page for the display.newText() function:
Creates a text object with its top-left corner at (left, top).
More specifically, down in the 'gotcha's' section:
Currently, there is no way to align text upon creation. It is recommended you create the text, then set the reference point using object:setReferencePoint(), and adjust the x and y coordinates accordingly.
This spells out pretty clearly what you need to do to get your desired results.
Related
Need some help with shape formatting.
Seems like there must be an easy way to do this, but I can't seem to figure it out.
I want to lock the size of the blue circles shown below, but still want to be able to move them.
The purpose of the blue circles is to drag and drop into the bullseye target during robot leveling checks.
I just don't want to allow the user to change the size of the blue circle when selecting it and placing it in the bullseye target.
Use Line (shape) instead of a circle.
Step :
Insert (a very short) line.
set weight (around 5-6 pt)
set Begin Arrow Type : Round
The will look like a circle. ( :
Done.
p/s : by defining a very short line there is no 'radius' parameter.
Here is my Sandbox for this question: https://codesandbox.io/s/gridspacing-x2fy3?file=/src/Home.jsx
The layout is almost looking how I want it to; however, I would like to be able to adjust spacing between the components within the inner column Grid. Right now, even though I put spacing={4} on line 45 in Home.jsx, it makes no difference whatsoever if I take that line out or replace the value with some number other than 4. I expected the spacing between the components in that Grid to change dependent on that value.
What am I doing wrong and how should I fix it to be able to adjust spacing? Thank you.
I've been trying to make a chart comparing two sets of data from 40 countries, but every time I try to make the chart, it shows one data set perfectly normally and the other set is just displayed as zero.
I've tried changing from points to commas and everything else I can find online, but nothing is working.
I know absolutely nothing about coding, so please consider that when helping me out. I'm just trying to fix this for my maths assignment.
Thanks in advance!
The other set is not displayed as zero! If you could use a ... microscope, you would notice that the orange dots are slightly above ground!
Each square in your diagram has a height of 0,5E15, which may also be written as the number 500.000.000.000.000 (5 followed by 14 zeros).
Imagine now that you want to place the dot that corresponds to the Albanian AAS number, which is 2.907.909,20. This is a minuscule number in relation to the height of each square. Excel thus naturally places that dot very close to the bottom of the first square, leading you to believe that it touches the horizontal zero line.
What you can do is the following:
Select with your mouse the line consisting of the orange points. Then right-click and select "Format Data Points" (or the German equivalent, I suppose "Formatieren Datapunkten"). Then search for "Series Options", where you will see the following two choices for "Plot Series On":
Choice 1: Primary Axis
Choice 2: Secondary Axis
Select the second choice and you problem will be resolved.
Viel Glück!
How i can add a multi-line text with itext on diagonal. meaning that if the text is to large for the first diagonal(the largest diagonal) it should move on the next or above diagonal and so one, to see all the text.
I already calculated the text angle for the diagonal and uses pdfcontentbyte to stamp but if my text is longer than the diagonal the rest of the words that don't fit on the diagonal it is not showed. I think i have to make something mathematical or i saw something with setsimplecolumn and chunks but this will show my text aligned horizontal.
If anyone has some ideas? Thanks, and of course need some code examples.
Don't shoot me if I'm wrong, but based on your description I think you're talking about 'irregular columns'. See http://itextpdf.com/examples/iia.php?id=67
This type of column isn't a rectangle. Basically, you define coordinates for the left border (can be a diagonal line) and coordinates for the right border. Then you pour text between these two lines.
If that's not what you meant, maybe you want to write text diagonally. In that case, you can still use ColumnText, but you need to change the coordinate system, so that the text isn't written in horizontal lines from left to right, but in diagonal lines from top to bottom (or bottom to top). Changing the coordinate system is done with the concatCTM method.
I was trying to make my own function to reposition data labels on line chart so they'll be in their best fit.
What does it mean best fit?
The data label wont be above the line itself (I took the higher angle of the point and put the data label in higher-angle/2 - so it will be in the middle of the higher angle) - I succeed to get the higher-angle but didn't succeed to get the position on graph (in pixels, relatively)
After u put the data label in the middle of the higher angle, you need to check with the other seriescollections, that the data label is not above one of other seriescollections line... - didn't reach this part.
and still I am not sure that's it...
Is anybody got something prepared? or someone wants to help me with it?
It is way over my level right now...
"Best fit" is a setting unique to pie chart data labels.
You have the option of positioning a line chart's data labels centered (directly on a point), as well as above, below, left of, and right of the point. You can also position the data label anywhere by changing the .left and .top properties of the label. Left and Top are in points with respect to the top left corner of the chart, so you will have to brush up on your algebra to fine tune label positioning.
As with all else involving charts, Keep It Simple is sound advice. Do you need to label everything, or can you get away with a few key labels?
So after some tries, I decided to ditch the idea since this's way too complicated for me.
What I can say is that I ditch it after I stepped up a little bit.
I could find the best position for each label only when there's one line.
I achieved it by calculating the bigger arc (assumed each point is the middle of a circle), and than put it in the middle of that arc.
to do it when you have more than one line, you have to consider the position of the points of the other line/s. Therefore it becomes much more complicated and this is the reason I decided to ditch it.