treemap can't render box when containing text that is too large - rascal

When creating a treemap structure with boxes, boxes with a text that is larger than the box itself are not drawn.
Below the same treemap is show twice: once with text, once without text.
treemap with text
image without text
How do I prevent this from happening?

I'm pretty sure this can't be prevented. The reason is that the box sizes have hard constraints on their sizes (the size is as meaningful as the height of a bar in a bar chart), so they can't grow with the size of the enclosed text.
To fix this you could generate shorter labels (removing all the vowls and truncating them) and showing the full label as a tooltip? Or you could have a box with a label in it on the side which contains the currently hovered box?

Related

How to check if an image contains horizontal or vertical text region

I have images with text written vertically in some cases and horizontally in others. I need to process horizontal and vertical text images differently. Hence, for that I need to first check if the image contains a vertical text or not.If someone can suggest some way of finding if an image contains vertical text or not, it will be helpful. For example see the following imageshttps://i.stack.imgur.com/A5txz.jpg and https://i.stack.imgur.com/7LU28.jpg. The first one contains a vertical text and the second one contains a horizontal text.

Align two UILabel texts

I would like to align the start of the text of two UILabels. I aligned the two UILabels (with the yellow and grey background) and used sizeToFit: to shrink the UILabels to the content but the text is not perfectly left aligned. There is a gap on the left. The gap is bigger or smaller depending on the first character. I would like to align the red lines in the following picture. There is even a small gap with the small font in the grey UILabel but it's barely visible.
With the Z character the gap is smaller but still visible by the yellow area left to the Z
A simple UILabel alignment does not help for my specific problem, because the text content is dynamic and not static. So there could be any combination depending on the data I get from the backend. Therefore I was hoping for a UIFont or UILabel attribute that could return the size of the gap based on the current rendering of the text.
I know that there are great UIFont related attributes like baseline, capHeight and ascender one can access to align text but there seems to be no attribute that would return the value of this gap on the left.
If this doesn’t need to be two UILabels, you could have one with attributed text. Then both lines would be subject to the same layout.
I haven't tried the GUI which people have been posting Screen Shots of, however... the behaviour is consistent with the very nature of typography.
The font sizes are completely different, therefore the width of an em is different, subsequently the letter-spacing is also different.
See this: http://www.w3.org/WAI/GL/css2em.htm for more information.
I know this answer doesn't give you what you have asked for, however it should explain why this is happening.
For customisation such as this (if HTML and CSS) I would use a negative / positive margin on the sub text, however seeing as you are using backgrounds use padding (or the equivalent in your GUI).
Use attributed text of UILabel
set indentation as per your requirement
ref screen shot
Select both the labels and add a constraint called align leading edges.

Setting different colours to the same character of a label

How to set two different colours to the same character of a label (like NBC APP's schedule date selection. in centre selected box, the text colour has been changed regardless of character range of the label).
Sample image:
Thanks in advance.
Not exactly an answer to your question, but you can probably achieve this by:
Create two views, each containing a label, both with the full text.
Change the color accordingly.
Put the second view (with the blue text) below the first one (grey text).
Change the frame size of your first view so only half of the text is displayed.
If no truncating happens to the text, you should end up with the above effect.

HighCharts: SVG outside plot area

I am designing an HighCharts bubble chart (a matrix with coloured fields, drawn using SVG), that should have some text explaining the axis values outside of the actual chart area.
That is, because the axis values are A-E and need a lengthy explanation (A = Always exceeds goals bla bla etc.).
These explanations should be visible - next to the chart, not in it, and not in tooltips because these cannot be printed.
My question: Can I put SVG <text/> outside of the plot area? HighCharts seems to stretch the plot area as far as it can, leaving no space to either side.
You can use text text and define css styles i.e: position:absolute;left:20px;top:20px;

How do I make a TCheckListBox scroll vertically?

I've got a TCheckListBox on a form. Its Columns property is set to 2, and if there are more items than can fit on-screen in two columns, it puts a horizontal scrollbar across the bottom of the control.
Thing is, the way this form it laid out, it would be much more convenient to scroll vertically. But I can't seem to figure out how to make the box do that. I thought setting Columns to 1 should work, but it doesn't.
Anyone know how to make a TCheckListBox scroll vertically instead of horizontally?
You need to set Columns to 0.
For all positive values the VCL sends a LB_SETCOLUMNWIDTH message to the underlying native list box control, with the width parameter set to the list box client width divided by the number of columns. Items that don't fit will start a new column with the same column width, so the horizontal scrollbar becomes visible.
If Columns is 0 then there is a single column that spans the entire client width of the list box, and items that don't fit will make the vertical scrollbar visible, and hide the horizontal scrollbar.
Edit:
There seems to be genuine interest what happens when a negative value is used for the Columns property.
The method TCustomListBox.CreateParams() sets the LBS_MULTICOLUMN list box style depending on the Columns property being different from 0. For negative values the style flag is set, but the VCL doesn't send the LB_SETCOLUMNWIDTH message, so the native control uses the default column width. It is documented to be:
15 times the average character width for the font used by the list box.
(Search for "The LBS_MULTICOLUMN style specifies" to find the relevant passage of text.)

Resources