ngx-charts-bar-vertical-2d minimum bar width - ngx-charts

I would like to set the width of the bars to be a minimum of 12px. I would actually prefer to have a fixed width on the bars period.
As an example, when I am displaying 10 days of data, the graph looks fine, but for 30 days, it does not look good at all. Any thoughts on making this look better?
I added a horizontal scroll, but the width of the bars is automatically calculated based on the number of items in the graph, irrespective of the graph width. Is there any way to alter this behavior?
Screen capture: https://share.getcloudapp.com/yAubDN8X

Try adding [barPadding]="1" to ngx-charts-bar-vertical-2d element
<ngx-charts-bar-vertical-2d [barPadding]="1" ...>...</ngx-charts-bar-vertical-2d>

Try adding [groupPadding]="1" to ngx-charts-bar-vertical-2d element
<ngx-charts-bar-vertical-2d [groupPadding]="1" ...>...</ngx-charts-bar-vertical-2d>
as long as you minimize the padding between groups, the barWidth with grow automatically !

Related

xcode - autolayout - prevent overlap of logo + input with footer button

I am having trouble preventing the text inputs from overlapping the footer button.
The footer has been anchored to the bottom of the screen. All the elements up top (logo, title label, and 2 input boxes) all have relative constraints. I try to add a constraint between that last input and the footer button but it pushes the footer off the screen on the smaller iphone.
What do I do??
https://github.com/civilordergone/taskfort_ios
Your issue seems to be in landscape only (I ran your code), where you have, for example, 320 points of vertical space, and an image (128pt), a text label (120pt), two text fields (30 each, for 60pt in total) and a 30pt button at the bottom. Already that's 338pt used, and we haven't accounted for the vertical spacing between your objects.
There simply isn't enough vertical space for all of these items to be vertically positioned while retaining their heights, so something has to be flexible: something has to be able to be vertically shrunk/compressed. Your logo and app name (Taskfort) are two candidates.
Here are some of the changes and/or points of consideration:
An ImageView with a height and a width equality constraint will always be that size, but for your layout, it has to be able to be compressed. I removed the height & width constraints and added an Aspect Ratio constraint, so the logo keeps its aspect ratio, but can now scale. I added a relationship constraint between the logo's left side and the left side of the Taskfort label.
The image has a relationship to the top of the screen, saying it must be equal or greater (not less than) to 0. This just means "the image can't be pushed off the top", which "less than" would allow it to be. (For example, if the image is pushed off the top by -40 points, that's still "less than 20").
The image has to be allowed to be vertically compressed. There is a property for "Vertical Compression Resistance" that was 250, and is now 249. By setting it to 249, we're saying "If something has to give way, vertically, this object can be compressed." Since we defined an aspect ratio constraint, if it does get compressed vertically, it'll be reduced horizontally by a proportionate amount so as to maintain the proportions of the logo.
To prevent the text fields from overlapping, their relationships are set to "equal or greater than". Same for the Username text field to the label.
The challenge was in defining the relationship between Password and the Create Password button at the bottom. I added a constraint that says their vertical distance must be greater than or equal to 20. This has a priority of 1000 (by default), so at all times, you get 20pt or greater between those two. Without this, your password field and your button overlap.
While step 5's constraint solves the overlap problem, it creates a new one in portrait orientation, where the password is now 20pt from the button, instead of being lovely white space. To fix that, we add a second constraint between the password field and the button, and specify that the vertical distance is to be 228pt between them both. Now that creates a constraint conflict because you now have two constraints that are both trying to define the vertical relationship between the button and the text field. The 20-pt one is required, it has to be there. But the other one is just a "nice to have, if we can fit it".
So you set the priority of the new one (the 228pt) to be low, such as a Priority of 250. Then the layout engine will use the required one (must be 20 pt or greater) and then it sees the other one ("make them 228") and it tries to do that. If it can't, such as in landscape, then it doesn't do it and doesn't complain, because you have the other constraint already that provides positioning information. If you're in portrait and you have enough space such that it can also apply the low priority constraint, then it'll do that too, and your portrait layout now gets a bigger gap between top and bottom.
When testing these layouts, use the Assist Editor in Preview split-screen mode so you can see the affects of your changes without needing to run the simulator. Here's a guide on that.
Sounds like you're using an equality constraint, such as "the distance between lastInput.bottom and footer.top equals 20". Instead, try an inequality operator, such as "the distance between lastInput.bottom and footer.top is equal or less than 20".
The attributes inspector for a constraint can let you change an equality to an inequality. Alternatively, you can double-click the constraint line (the UI in the storyboard editor) to get a quick pop-up for that.

Two NSTextFields with interdependent widths in autolayout

I’m trying to put together what seems to be a simple case of two NSTextFields with dynamic width and fixed spacing in between. I cannot figure out an effective way to do so though.
I’m looking to get something like this:
The blue boxes are the NSTextFields. When more text is entered into one, it should grow and thus make the other one shrink, maintaining the lead space, trailing space and the spacing in between the fields. The first one should take the priority if both of the fields have too much text. Each field will also clearly have a maximum and a minimum possible width it can reach.
How would I go around handling this, preferably utilising IB autolayout as much as possible?
It seems to me that all of constraints you mentioned directly translate into interface builder --
First view has width >= something.
First view has width <= something
Same for Second view.
Space between views is fixed.
Second view wants to be as small as possible (have its width at 0) but this has lower lower priority than the previous constraints and lower priority than inner content size constraints.
The code I had to add to my view controller, after applying the constraints as per the ilya’s answer:
In controlTextDidChange (_controlWidthConstraint refers to the fixed width constraint of the input; it’s probably 0 by default for the second input):
// Get the new width that fits
float oldWidth = textControl.frame.size.width;
[input sizeToFit];
float controlWidth = textControl.frame.size.width;
// Don’t let the sizeToFit method modify the frame though
NSRect controlRect = textControl.frame;
controlRect.size.width = oldWidth;
textControl.frame = controlRect;
_controlWidthConstraint.constant = controlWidth;
The key lies in invalidating the intrinsicContentSize for the text field when text is input.
You can check a sample project here, to get you on the right track.

reportviewer bar chart, bar width incorrect

I have a problem with a report that is build using report builder 2.0, on a sql2008 database (latest service pack installed), reporting services Version 10.0.5500.0.
The problem is that the bars are wider then they should be. Each bar should be as width as 1 hour.
The x-axis is configured with the interval set to hour and an interval value of 1 the min-value of =TimeSerial(0,0,0) and max-value of =TimeSerial(23,59,0). The series has a CategoryField set to the [hour], a column of type time with the time of an hour (Example 08:00:00.0000000).
What you are looking for is in the properties grid under General--> Custom Attributes --> PointWidth
You have to select the series first.
If you can't see the properties grid you need to enable it from the ribbon. View, check the box next to properties.
Numbers less than 1 will give gaps between the bars, number greater than 1 will cause the bars to overlap.
It's more of a relative width setting than abosolutely related to your Hour interval, but you can tweak it so its right.
Personally I would suggest you have it slightly less than an hour because they look better with gaps.
barchart1.png
You should also set the labels on the horizontal axis to be vertical and then rotate them so it looks a bit better.

auto adjusting the positions and height width of UILabel in iOS

I have designed my help page for my application,it contains some FAQs..so I have used UILabels for question and answer,I have adjusted,x,y,width and height exactly in the xib,leaving a gap between a question and answer and answer and next question.so totally I have some 10 question and answers,I have put them inside a scroll view.
But now, suppose the text changes dynamically, how can I adjust the positions and width and height,is a problem which I am not able to figure out, by using the below code,it adjusts the height and width of a particular label,if the text increases
NSString * test=#" It may come as a rude shock, but Facebook users should not feel surprised if tomorrow they come across their photos existing in the web world despite having deleted them personally long ago.";
m_testLabel.text = test;
m_testLabel.numberOfLines = 0; //will wrap text in new line
[m_testLabel sizeToFit];
but then, my next label will clash with it..is their any way so that all the labels get adjusted according if the width of any label increases or decreases?
Hope you all have understood my question..
Did you look into the below function, pass the font you have used and the size to which u want to constraint the label into.
- (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size

Objective C: Change Line Width Using UISlider

I have this code to change the stroke width of the line i'm using to draw on the screen.
- (IBAction)changeSize:(id)sender
{
if (Slider.value > 25.0)
{
Width += 3;
}
}
It's working but when i drag the slider thumb straight to the maximum it just adds a little size only but when i do it partly it's getting bigger each step.
Also, when i decrease it on the UISlider it still adds more... it's not decreasing...
How can i do resizing using UISlider??
It looks like you are telling it to increase the width by 3 when the slider is changed.
You would need to set the width equal to the slider value.
Well, you need to understand how sliders work. The Slider.value is your current slider value and it goes from Slider.minimumValue to Slider.maximumValue, witch you can set when creating the slider. You should set those to your minimum line stroke and to maximum line stroke.
In your changeSize method you should then only have 1 line: Width = Slider.value; What you are doing now, is that each time you move the slider and its value is larger then 25.0, you increase the stroke by 3.
As for the speed of slider movement effecting the stroke in your case: How many times the method changeSize will be called is time based, not value. So if you slide it faster, it will be called lesser times then if you slide it slowly, therefor increasing your Width lesser times by 3.