How to resolve Teechart Legend Checkboxes moving left and right due to changes in decimal values - legend

(ColumnWidthAuto = true is set). Legend alignment is bottom . How to make checkboxes aligned to left so that they wont move left and right when there is a change in value at runtime.

Related

Amcharts4 legend label not truncated when value is right aligned

I am creating a pie chart with the legend at the bottom. I have added the config to truncate the legend label by passing
chart.legend.labels.template.maxWidth = 120;
chart.legend.labels.template.truncate = true;
Works fine until i try to right align the value by passing
chart.legend.valueLabels.template.align = "right";
After adding this, the labels are not truncated and occupy the full width.
Any help on how to achieve both truncating and also having the values aligned to the right would be much appreciated. Also I could not find any adapter method to overwrite the label. If so, I can strip the label after certain characters and return.
Here is a codepen demo of the above mentioned issue.
It was an issue acknowledged by the amcharts team and it was fixed later.

How to prevent RichTextBox to change alignment automatically?

I am programming a text editor and I use richtextboxes.
In one of the richtextboxes I need the text aligned to the right, so I use:
RTB.SelectAll()
RTB.SelectionAlignment = HorizontalAlignment.Right
RTB.DeselectAll()
And it's ok, the text is horizontally aligned to the right. The problem is when I do any change (for example, pasting some text or any other change) all the text in that RichTextBox gets automatically aligned to the left again (originally it was left aligned).
What should I modify to prevent the text to align again to the left after I have applied right alignment?
Thanks.

How can I make all panels resize equally when form is maximized

Currently when I maximize my form it resizes as it looks below.
This is due to the anchoring element stretching the two bottom panels on the left as well as causing a gap on the right since nothing is anchored right. I could fill the gap on the right by anchoring the right most panel however that would just cause it to be wider than all the other panels.
What I want is an equal resizing of the panels when the form is maximized as depicted below
How can this be achieved?
Use TableLayoutPanel:
Add TableLayoutPanel to the form and set Dock = Fill
Add 2 rows to the TableLayoutPanel (by default there is already two)
Row 1 - Height = 50%
Row 2 - Height = 50%
Add 4 columns to the TableLayoutPanel (by default there is already two)
Column 1 - Width = 25%
Column 2 - Width = 25%
Column 3 - Width = 25%
Column 4 - Width = 25%
Four panels on the left side put inside every cell of first and second columns and set Dock = Fill
Two panels on the left side put in the third and forth columns of the first row, set RowSpan = 2 and Dock = Fill

Why can't I set DataLabel.Position to xlLabelPositionCustom?

I am working with vb.net and excel 2007 to create some graphs for myself. I wanted to set the datalabel positions to a custom value since the default above position (xlLabelPositionAbove) causes the labels to clash with error bars and the default option for a side (such as xlLabelPositionRight) may leave the label over another point or other errorbar. Due to this, I wanted to set the label to a custom position where it is off to about a 45 degree angle to the top right (like right in the middle of where the default above and right positions would place it).
I tried doing this by adjusting xlMySeries.Points(index).DataLabel.Top and xlMySeries.Points(index).DataLabel.Left at first, however I ran into an undescriptive error leading me to believe I was not doing things correctly. I then thought to try setting xlMySeries.DataLabels.Position = xlLabelPositionCustom and then adjusting top and left. However, to my surprise, I could not even change xlMySeries.DataLabels.Position to xlLabelPositionCustom!
Whenever I try to adjust top, left, or the position to certain datalabel positions, I get HRESULT: 0x80004005 (E_FAIL), which I have generally found to mean "You are doing it wrong" in my experience so far with excel. I cannot set the position member to custom, or anything other than just above, left, right, center (so not bestfit, custom, or any inside___ one)
Any idea why I cannot set the position property to what I need it or otherwise change the position of my datalabels? I just need SOME way to adjust the positioning of my datalabels to a custom psoition (or position other than above, left, right, center, bottum). Thanks in advance!
You can set positions only to whose which you can see on the Data Label properties window.

Label position should fixed right and grow to left

How can I set my labels to align on the right even when they have diffrent lenghts.
I have a set of labels which are occuring next to each other and also underneath each other.
The problem now is that they always align from the left within the label row,but I need them to align on the right as they are showing sums from other rows. Just to verify I am not talking about the text align I am looking for a solution to align my labels.
Thanks in advance
Simply set the AutoSize property to False in the designer. Adjust the size to fit the column. Then set the TextAlign to one of the right-alignment ones.
You should be able to do it at runtime using the following code:
'find the current right alignment position
Dim rightAlign As Integer = Label1.Left + Label1.Width
'set the text (assumes AutoSize is set to True)
Label1.Text = value
'adjust position so the right hand point is in the same position as before
Label1.Left = rightAlign - Label1.Width
My method is even more strange. I create the labels and then when laying out the fields for the report adjust the labels for number (etc) that are to be right aligned
Note: all labels end with 'lbl'
- txtNew is the report column text box.
- get the column's left edge plus the width of the column minus the width of the label. Works! Just not my favorite way to do it.
' *** NEED TO CALC POSITION FOR RIGHT JUSTIFY OF LABEL !!!!!
If ShouldRightJustify(rs.Fields(i).Type) Then
rpt.Section(acPageHeader).Controls(rs.Fields(i).Name & "lbl").Left = _
(lblCol + txtNew.Width) _
- rpt.Section(acPageHeader).Controls(rs.Fields(i).Name & "lbl").Width
End If
If you are asking how to do this from the designer, use the Format Menu.
Select all the controls you want to align, then click the control you want the other aligned to. Do Format > Align > Rights.
If you are trying to do this at run-time you can loop through the controls you want to align and set their .X property according to their width. For example. To align a label so that it's right side is at X=200... SomeLabel.X = 200 - SomeLabel.Width.