I am trying to add a legend to my chart similar to how is done in the LegendChartView.swift code in the sample app. However the legend does not show and I get several NSLayoutConstraints conflicts such as this one:
[LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (
"<NSLayoutConstraint:0x283528af0 UIButton:0x13c52d840.height == 25 (active)>",
"<NSLayoutConstraint:0x2835285f0 UIButton:0x13c52d840.bottom == UIView:0x13c545060.bottom - 4 (active)>",
"<NSLayoutConstraint:0x2835285a0 V:|-(4)-[UIButton:0x13c52d840] (active, names: '|':UIView:0x13c545060 )>",
"<NSLayoutConstraint:0x283528b40 'UIIBSystemGenerated' SCIDefaultLegendItem:0x13c543f90.top == UIView:0x13c545060.top (active)>",
"<NSLayoutConstraint:0x283528b90 'UIIBSystemGenerated' V:[UIView:0x13c545060]-(0)-| (active, names: '|':SCIDefaultLegendItem:0x13c543f90 )>",
"<NSLayoutConstraint:0x283529c20 'UIView-Encapsulated-Layout-Height' SCIDefaultLegendItem:0x13c543f90.height == 0 (active)>" )
Will attempt to recover by breaking constraint <NSLayoutConstraint:0x283528af0 UIButton:0x13c52d840.height == 25 (active)>
The internal SCIDefaultLegendItems look to keep setting their width and height to 0 which causes conflicts with the underlying UIButton and UILabel components.
Any thoughts on how to get around this? My chart has four series. I have seen the article on drawing the legend outside the chart surface area however I do not want to do that.
Thank you!
- Brad Taber asked 4 years ago
-
Hi Brad, have you looked at our documentation here? Please give it a try and let us know if that helps. https://www.scichart.com/documentation/ios/current/legend-modifier.html#adding-the-scilegendmodifier-to-a-chart
-
Thank you Nazar, I have reviewed that. I actually think this may have to do with my rendering process in general as I get constraint problems and crashes even when drawing the SCIChartLegend with manual constraints outside the chart surface. I believe this issue started when I moved to v3.0 which no longer has surface.renderSurface.renderedCallback. Without renderedCallback anymore – how do we know when drawing has ended with v3.0?
-
hi brad, I’ve updated answer in the post here – https://www.scichart.com/questions/ios/how-to-show-loading-state
-
if possible, please post the answer to your own question if you figure it out for the sake of community. Thanks
- You must login to post comments
This issue is fixed in version 3.1.0.5175. I am no longer getting these constraint problems or the crash upon upgrading from 3.0 to 3.1.
- Brad Taber answered 4 years ago
- You must login to post comments
Please login first to submit.