Title: Adding image to annotation labels! · Issue #10 · ABTSoftware/SciChart.iOS.Examples · GitHub
Open Graph Title: Adding image to annotation labels! · Issue #10 · ABTSoftware/SciChart.iOS.Examples
X Title: Adding image to annotation labels! · Issue #10 · ABTSoftware/SciChart.iOS.Examples
Description: Hi SciChart team, I would like to add and image to annotation without any text. Here is my code to create annotation: ` triggerHorizontalLine.set(y1: 0.0) triggerHorizontalLine.set(x1: 0.0) triggerHorizontalLine.isEditable = true trigger...
Open Graph Description: Hi SciChart team, I would like to add and image to annotation without any text. Here is my code to create annotation: ` triggerHorizontalLine.set(y1: 0.0) triggerHorizontalLine.set(x1: 0.0) trigger...
X Description: Hi SciChart team, I would like to add and image to annotation without any text. Here is my code to create annotation: ` triggerHorizontalLine.set(y1: 0.0) triggerHorizontalLine.set(x1: 0.0) trigger...
Opengraph URL: https://github.com/ABTSoftware/SciChart.iOS.Examples/issues/10
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Adding image to annotation labels!","articleBody":"Hi SciChart team,\r\n\r\nI would like to add and image to annotation without any text. Here is my code to create annotation:\r\n\r\n` triggerHorizontalLine.set(y1: 0.0)\r\n\r\n triggerHorizontalLine.set(x1: 0.0)\r\n\r\n triggerHorizontalLine.isEditable = true\r\n\r\n triggerHorizontalLine.xAxisId = axisId\r\n\r\n triggerHorizontalLine.horizontalAlignment = .fillHorizontal\r\n\r\n triggerHorizontalLine.stroke = SCISolidPenStyle(colorCode: SciChartColours.horizontalLineStyle, thickness: 2.5, strokeDashArray: [2.0, 4.0, 2.0, 4.0], antiAliasing: false)\r\n\r\n let lineAnnotationLabel = SCIAnnotationLabel()\r\n\r\n lineAnnotationLabel.labelPlacement = .topLeft\r\n\r\n triggerHorizontalLine.annotationSurface = .aboveChart\r\n\r\n triggerHorizontalLine.annotationLabels.add(lineAnnotationLabel)`\r\n\r\n\r\nAnd also I added an extension:\r\n\r\n`import SciChart\r\n\r\nextension SCIAnnotationLabel {\r\n \r\n func addImage(imageName: String) {\r\n let iconsSize = CGRect(x: 0, y: 0, width: 130, height: 130)\r\n let imageAttachement:NSTextAttachment = NSTextAttachment()\r\n imageAttachement.image = UIImage(named: imageName)\r\n imageAttachement.bounds = iconsSize\r\n self.attributedText = NSAttributedString(attachment: imageAttachement)\r\n }\r\n}`\r\n\r\nAnd then later I add an image \r\n\r\n`self.triggerLineList[self.selectedTabIndex].annotationLabels.firstObject.addImage(imageName: ImageNames.btnDutyImage)`\r\n\r\nApp is crashing in the library and here is the debug output:\r\n\r\n```\r\n2020-08-12 10:33:12.258598+1000 PokitMeter - Dev[339:20686] [Unknown process name] CGContextSetTextMatrix: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.\r\n2020-08-12 10:33:12.258833+1000 PokitMeter - Dev[339:20686] [Unknown process name] CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.\r\n2020-08-12 10:33:12.258948+1000 PokitMeter - Dev[339:20686] [Unknown process name] CGContextRotateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.\r\n2020-08-12 10:33:12.259041+1000 PokitMeter - Dev[339:20686] [Unknown process name] CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.\r\n2020-08-12 10:33:12.259352+1000 PokitMeter - Dev[339:20686] validateTextureDimensions, line 1226: error 'MTLTextureDescriptor has width of zero.'\r\nvalidateTextureDimensions:1226: failed assertion `MTLTextureDescriptor has width of zero.'\r\n\r\n```\r\n\r\n\r\nIf I add text to the attributed string crash issue is getting fixed but it does not show my image:\r\n```\r\n\r\nextension SCIAnnotationLabel {\r\n \r\n func addImage(imageName: String) {\r\n let iconsSize = CGRect(x: 0, y: 0, width: 130, height: 130)\r\n let imageAttachement:NSTextAttachment = NSTextAttachment()\r\n\r\n imageAttachement.image = UIImage(named: imageName)\r\n imageAttachement.bounds = iconsSize\r\n \r\n let myString:NSMutableAttributedString = NSMutableAttributedString(string: \"RISING TRIGGER\")\r\n myString.append(NSAttributedString(attachment: imageAttachement))\r\n \r\n \r\n self.attributedText = myString\r\n }\r\n}\r\n```\r\n\r\nIt would be great if you could show me how to add image to annotation labels.\r\n\r\nThanks","author":{"url":"https://github.com/bernard-ingenuity","@type":"Person","name":"bernard-ingenuity"},"datePublished":"2020-08-12T00:38:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/10/SciChart.iOS.Examples/issues/10"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:994e2640-aa25-1dcc-ae76-426945f1fbe4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B69C:1B74C:EDFFA6:12E3ED7:698FED73 |
| html-safe-nonce | e48951126872c66f64756a964cab3fd5ccb5c34419291670ef147a2fa897c3fc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjlDOjFCNzRDOkVERkZBNjoxMkUzRUQ3OjY5OEZFRDczIiwidmlzaXRvcl9pZCI6IjE1MTM0NDY1MDcyMjI2NTg0MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3158232d7973cf2958d4dd41fe20be117830bff43da28e12f9d74f2bf5aa7a25 |
| hovercard-subject-tag | issue:677290106 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ABTSoftware/SciChart.iOS.Examples/10/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dfaa8f928b363cf8580a68ed7716a935ba3c96a2ee03b6fc33e566af03cd0ac3/ABTSoftware/SciChart.iOS.Examples/issues/10 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dfaa8f928b363cf8580a68ed7716a935ba3c96a2ee03b6fc33e566af03cd0ac3/ABTSoftware/SciChart.iOS.Examples/issues/10 |
| og:image:alt | Hi SciChart team, I would like to add and image to annotation without any text. Here is my code to create annotation: ` triggerHorizontalLine.set(y1: 0.0) triggerHorizontalLine.set(x1: 0.0) trigger... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bernard-ingenuity |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/ABTSoftware/SciChart.iOS.Examples git https://github.com/ABTSoftware/SciChart.iOS.Examples.git |
| octolytics-dimension-user_id | 14130255 |
| octolytics-dimension-user_login | ABTSoftware |
| octolytics-dimension-repository_id | 80605151 |
| octolytics-dimension-repository_nwo | ABTSoftware/SciChart.iOS.Examples |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 80605151 |
| octolytics-dimension-repository_network_root_nwo | ABTSoftware/SciChart.iOS.Examples |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width