Thank you for your response Nazar, that did put the labels on the left side of the axis, but now the axis is offset by some amount to the right by doing this. YAxisPosition is set to be 0 and absolute. I've addded a screenshot to the question. (shiftedAxisWrongOffset)
I've forgot to mention that you would need to slightly modify ShiftedAxesBehavior, if you change axis alignment. In your case, you need to consider width of yAxis while placing axis in behavior, so you need to change Canvas.SetLeft(yAxis, yAxisPos) to Canvas.SetLeft(yAxis, yAxisPos - yAxis.ActualWidth) inside SciChart_OnRendered. Hope it helps. Best regards, Nazar.
Hi Nazar, SciChart_OnRendered is being called twice when first rendering for some reason (no size changes in the window) the first time yAxis.ActualWidth is 3.0 which seems OK, but the second time it's 4482 for some reason, so the axis goes off the window. I just realized using ActualWidth doesn't render the axis on the first two passes (as it's actualWidth is calculated as 4482) but if I resize the graph again, the actualwith is correct but still has a slight wrong offset, I've put an X on 0,0 to show you where 0 is supposed to be. So the current problem I'm having is, On initial render the yaxis is off the screen, if I make it fullscreen the axis still has an offset, if I resize by dragging the mouse the yAxis "finds" it's spot where it's supposed to be. This is a little bit confusing so I've added some screenshots for each cases. Thank you
6 years ago
Hi Kewur, could you please send us a sample project which reproduces the issue? Thanks ahead.
I was able to reproduce the yaxis being off the screen initially, but couldn't reproduce the full screen offset problem yet, I'm working on it but I'm going to have to come back to it later. I'll update you when I have it. I can't upload it to the answer because it's throwing an unhandled exception on the web site (on upload zip files): "Uncaught TypeError: Cannot read property 'length' of undefined" when uploading the zip file. it is 1.15MB though so I'm not sure if that's the problem. Please let me know where I can send this project.
Hi there, If you're using WPF you can change suggested workaround for left aligned axis. instead of:
Canvas.SetLeft(yAxis, yAxisPos - yAxis.ActualWidth)
please try to use:
Canvas.SetRight(yAxis, yAxisPos); This should provide correct placement of left aligned axis on startup.
Hi Yura, that doesn't solve the initial problem I've had unfortunately. If I don't subtract by size the Yaxis position is not on the place it's supposed to be. Please see the 5th screenshot on this question to see the behavior that I'm getting when I remove - yAxis.ActualWidth.
I have fixed the axis not showing up initially when the graph first launches. To test it replace Canvas.SetLeft(yAxis, yAxisPos); with yAxis.SizeChanged += (s, e) =>
Canvas.SetLeft(yAxis, yAxisPos - yAxis.ActualWidth);
}; I still have the offset problem though.