Timeline display until the end of the chart - lightweight-charts

Is there a property to display the values โ€‹โ€‹of the timeline to the border of the chart, and not just to the last point?

It might be done in several ways, depending on your needs:
you can apply one-time content fitting by calling ITimeScaleApi.fitContent method
you can restrict scrolling after the last available point by enabling fixRightEdge option

Related

How to make UIScrollView load data as scrolling happens

I have an IOS application designed for ipad. In one page, I display a report to the user and the report requires 5000 UILabels to be rendered on the screen inside a UIScrollView. This causes application to crash due to being out of memory. I know that UITableView has the functionality for loading content on demand. How can I make scroll view render only certain content and as the scrolling happens remove the content that got invisible and add the content that should be visible?
Is there any way you can reconfigure it to use a table view with custom rows, perhaps rows that consist of several labels? That model supports load on demand and resource reuse in a very natural way...
Perhaps you can be more specific on your screen layout?
You should re-cycle (i.e., reuse) the labels just like a table view recycles its table cells. This is sometimes referred to as "tiling" subviews. Tiling allows you to display more than will fit into memory.
I recommend watching WWDC 2012 Session 104. This session's tutorial creates a photo app that tiles image views in a UIScrollView. Although the photo app scrolls pages of content, rather than a grid of items, I think the video could be relevant to your app.
Here's a very brief overview of the tutorial applied to your specific case:
(1.) declare iVars that keep track of your labels:
NSMutableSet *recycledLabels;
NSMutableSet *visibleLabels;
(2.) implement a method that fetches a re-usable label:
- (UILabel *)dequeueRecycledLabel;
(3.) implement a method that does the tiling:
- (void)tileLabels; // this will add/remove labels from the scroll view
(4.) set your scroll view's delegate and call tileLabels in the scrollViewDidScroll: delegate method
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self tileLabels];
}
The WWDC video will help you fill in the details, which I think are applicable to your case. However, you will have to do plenty of improvising in order to make it work for your specific case. This may not be easy; but its doable.
At the end of the video, tiling with CATileLayer is discussed. I'll be honest, I didn't understand that part. But I don't think it's applicable in your case because you're not displaying large images.
I finally implemented dynamic content loading. The method I implemented is scrollViewDidScroll.
Inside this method I determined the direction of scroll by the following
bool isUp = (currentOffset.y > lastScrollOffset);
Then I determined the visible content rectangle by the following.
CGRect visibleContentRect;
visibleContentRect.origin = scrollView.contentOffset;
visibleContentRect.size = scrollView.bounds.size;
Then I had an array of View Elements and each knew its place in the scroll view because of their frame being set. Long story short, each time scroll happened, I determined the views whose frame either intersected or contained by visible content frame. I added those views to the scroll view. I also determined the ones that disappeared and removed them from scroll view and I also set those views to nil and recreated them. Once [scrollView addSubview:view] method is called, then view gets more space in the memory because it gets visible. [view removeFromSuperView] method doesn't deallocate that space. That's why setting the view to nil and recreating it is necessary.

Efficiently display multiple markers on WPF image

I need to display many markers on a WPF image. The markers can be lines, circles, squares, etc. and there can be several hundreds of them.
Both the image source and the markers data are updated every few seconds. The markers are associated with specific pixels on the image and their size should be absolute in relation to the screen (i.e. when I move the image the markers should move along with it, but if i zoom in, they should take the same space of the screen as before).
Currently, I've implemented this using the AdornerLayer. This solution has several problems but the most significant one is that the UI doesn't fare well under the load even for 120 such markers.
I wanted to ask what would be the best way to go about implementing this? I thought of two solutions:
Inherit from Canvas and make sure it is invalidated not for every
added marker but for a range of markers at once
Create a control that holds an image and change its OnDraw to draw all the markers
I would appreciate some pointers from someone with experience with a similar problem.
Your use case looks quite specialized, so a specialized solution seems in order. I'd try a variant of your second option โ€” extend Image, overriding its OnRender method.

Silverlight (wp7)

Being new to silverlight I'm struggling to 'get going' with the following.
Basically I wish to create some form of grid like control (custom or user?).
The idea is similar to that of a planner. Along the top are times (set intervals). Downwards are subjects. Then over the grid like background rectangles (or something) indicate when the subject is planned for.
The actual design of the above is not the issue. i.e. a grid with ractangles overlaid. But my issue is I wish this grid to be scrolled up and down (with bounds fixing the top and bottom when the subject lines start and end). And also the grid to be scrolled left and right (with bounds fixing how far left and right it can scroll, current time & 3 days into future).
Based on the above needs, I don't wish to create a control which is very large, and just dragged into view (unless this is the only way?) but instead show the grid at a current time and when dragged dynamically load the next few hours worth of content, possibly with a few hours buffer.
The appearance I am seeking is it looking like it is one massive control, but truely its not, its dynamic.
Does this make sense? Am I worrying about nothing? Should I create a massive grid well into the future and then just handle the load of data dynamically over the top? Its just my concern if I want a grid 3 month into the future this would be massive and a waste of memory.
I'm struggling to find examples on the net, but feel this maybe to do with me not knowing what to search for. This isn't about getting a detailed answer and someone doing it for me, but instead about guidance pointing me in the right direction.
Many thanks
About the up-down scroll: you can simply put a grid containing your data in a ScrollViewer control - this will handle all the scrolling for you. Another solution would be using a listbox control - this is better if you use MVVM. You can bind it to a data source and set as data template a custom control.
For the left-right scroll. I'm thinking you could use gestures for this. Like - catch left-to-right and right-to-left flicks and change the data in your grid / listbox according to the gesture's direction. You could also place two buttons at the top of the grid to handle scrolling from one day to the other (just like in the calendar controls: gestures + buttons).

WPF Custom Draw Multiple Progress Bar

In processing a group of items, I wanted to display a unified image of the status of the group, so I essentially made a Grid of a number of progressbars with transparent backgrounds and various colored foregrounds all at the same cell.
I'm running into some transparency artifacts (purple bar is actually purple under the green, and sometimes it draws over the top, etc) and it just seems a bit wasteful. So, I decided to make my own, but now I've got a bit of paralysis on how to do it. Do I use the DrawingContext in FrameworkElement's OnRender, or is there something simpler? Is there a set of general rules when it comes to making your own control?
I pondered switching to a pie chart since those are easy to come by, but its high time I did something not off-the-shelf.
Thanks!
I'm not quite sure how you intend the progressbar to combine different progresses, but if say the furthest along progress is at the bottom of the z-index and the least along progress is at the top, then I'd do something on the lines of this:
1) I would probably create a user control for this new progresbar.
2) It would have a property called NumberOfProgresses, that is tied with an array containing status of said progresses.
3) Each progress would be represented by a Border item (or perhaps something more suitable up the visual tree), because it's a simple wpf control with a background property. The background property would be set to nice a looking progress style and the progress color can be bound in the style to say the border's borderbrush property. Making it easy to set the color of the progress.
4) The user control would have a method UpdateProgress which takes the percentage value and the index of the progress in the array as parameters.
5) As progresses are updated you can either, just calculate the appropriate width (user control actual width * percentage) for the border and play around with the Z index to get it displayed at the top/bottom, or stack the borders horizontaly, set the least along progress as first, then for the rest of the progresses you'd have to substract previous progresses lengths to get the same effect.
This way there would be no transparency induced artifacts and no OnRender()...
Mind you, in WPF there should be no reason to mess with OnRender this and OnRender that, like it was required in WinForms with OnPaint.
Just set up the elements via code to get the look you want, and let WPF do it's rendering ;)
I can imagine one problem with this user control though. You'd have to provide feedback to the user as to which color belongs to which progress. But that would probably take you back to square one, meaning it's better/simpler to just display multiple progressbars.

Get airport display type transition when data changes

A client has asked for a display to flick over like an airport display screen, ie each row flicks over when information changes.
I am not sure which is the best control to use, or the method of getting each row to transform one after the other.
any suggestions woul b gratfully accepted
John
Here's what I would do in general concept..
Make a regular panel of, say 50px high. (This is arbitrary but this panel just holds the size in place so the control doesn't shrink with its contents.)
Create a panel inside that one that will be the 'animated' panel.
When it's time for information to animate, create a storyboard that uses a transformation to "stretch" the height down to 0, change the content to the updated information, then tranform stretch the height back to 50px. This will create the illusion that the panel is flipping over.
If you make this a user control, then you could simply add however many "rows" you needed of this control to a StackPanel to make your screen.
The best way of representing this effect easily is to randomize the text during the change.
Patrick Long implemented this effect as a custom animation here

Resources