-
Thanks!
-
I am attempting to understand a few things about this code. I can’t seem to get either this or the LineAnnotation to work properly. My code throws no errors but it doesn’t even appear. I will upload some example code that I have been working on to understand how this works. What is the purpose of having both the line and the ghost line? They seem to have the same values written to them the entire way through. I have been reading through the documentation and I am a bit confused on the GetAndAssertTemplateChild method. Is a template in SciChart what I would normally think of as a template? Some base code design that I can build off of? What is the template child in the case of a grid? Line? (I am assuming that the Line is the .net shape line (class) and not the scichart line (struct)). Aside from that, I believe I understand the code except I can’t get anything to appear. Again, the problem I have is not limited to this RayAnnotation, but also to the Line Annotation. I will attach the sln, thanks!
-
Hello! Multi comment so its easier to read: (1) Ghost line is used for hit-testing (e.g. detecting mouse clicks a few pixels wider than the line). It makes it easier to click. See discussion here: https://www.scichart.com/questions/question/verticalslicemodifier-touch-area.
-
(2) GetAndAssertTemplateChild () is basically loading in the ControlTemplate for that component. These are internal to SciChart, but also published here: https://www.scichart.com/documentation/v4.x/The%20LineAnnotation%20Type.html
-
(3) TemplateChild is basically referring to the parts of the ControlTemplate, e.g. PART_GhostLine and PART_Line as in the documentation here https://www.scichart.com/documentation/v4.x/The%20LineAnnotation%20Type.html
-
(4) If lineAnnotation doesnt show, you need to solve that problem first. I would suggest checking you have set X1,X2,Y1,Y2, that they are set to the Correct TYPE (X must be double, or DateTime for DateTimeAxis, or Integer index for CategoryDateTimeAxis) and are within the VisibleRange of the chart. That there are no exceptions in the output window and none thrown/caught in Visual Studio
-
This is great. Thanks! I bet it is because I wasn’t using the proper data type. I was using a double then tried the 00dd 00:00:00 format but that didn’t work either. I will try to figure out, in the example, what I am doing incorrectly. Thanks!
-
Also, I know it, the attached project, is called a bug in the project but it isn’t! >.< That is just how I named it when I thought I was looking for a bug.
-
You’ve used TimeSpanAxis, so Annotation.X1 must be a TimeSpan.
-
I figured it out. Thanks for your patience.
-
No worries, all the best!
-
I have a question regarding the projection: bool isRight = coordinates.X2Coord > coordinates.X1Coord; // Calulate projected X,Y point that touches the right/top edge, or left/bottom edge of the viewport double projectedX = isRight ? base.ParentSurface.ModifierSurface.ActualWidth : 0; double projectedY = coordinates.Y1Coord + m * (projectedX – coordinates.X1Coord); if (projectedY <0> coordinates.Y2Coord; // If the projected Y coord was above the top-edge, transpose the projection // so that X is calulated and Y is set to zero (top edge) projectedY = isUp ? 0 : base.ParentSurface.ModifierSurface.ActualHeight; projectedX = coordinates.X1Coord – coordinates.Y1Coord / m; } I am trying to figure out how to turn this into a full line, not a line segment like the lineannotation and not a ray. My first thought is to change projectedx and projectedy to projectedx2 and projected y2. Then created a projectedx1 and projectedy1. I feel like I want to do the reverse, double projectedx1 = !isRight ? base.ParentSurface.ModifierSurface.ActualWidth : 0; double projectedy1 = coordinates.Y1Coord – m * (projectedX1 – coordinates.X1Coord); The same for isUp. Then apply those values to GhostLine.X1/Y1 and Line.X1/Y1 Is this the correct approach? I am having a few problems here or there when I try to implement this.
-
Hi Ryan, Probably best writing a new answer with properly formatted code, as the above comment reads as a block and is kind of hard to understand.
-
I wish that would have formatted like how I typed it…
-
I added an answer but I am not sure if you get that alert.