3

I'm reworking existing functionality to use SciChart. I need the resulting graph to look identical to original solution (or as close as possible). [edit: had to redact the image due to possible client IP issues]

In the screenshot you can see where I got so far (top) compared to the old solution (bottom). I got stuck trying to make the labels work.

I implemented a custom label provider as described here http://www.scichart.com/screenshots-xps-printing-x-axis-text-labels/ (I basically just took the CustomLabelProviderClass from there) I use the same list of labels as the old solution. What you see is as far as I got, using the following axis properties:

<sci:SciChartSurface.XAxis>
<sci:NumericAxis VisibleRange="0,115" 
DrawMajorGridLines="False" 
DrawMinorGridLines="False" 
LabelProvider ="{Binding LabelProvider}"
TickLabelStyle="{StaticResource AxisLabelStyle}" 
AutoTicks="False" MajorDelta="0.5" 
MinorsPerMajor="1" MinorDelta="0.5" />
</sci:SciChartSurface.XAxis>

The old graph does actually skip some of the values as well (about every other, unless I zoom in) but it still displays them with about double the density of the SciChart. Is there a way to make SciChart behave the same?

Also, I applied rotation transform on the labels to get them vertical. As you can see, now they stick into the graph. Is there a way to move them down a bit?

Shaggydog
  • 3,456
  • 7
  • 33
  • 50

1 Answers1

3

In SciChart, the axis automatically culls labels that are too close, by measuring them and removing alternate labels.

You can disable this feature by setting AxisBase.IsLabelCullingEnabled = false

 // C# example
 var numericAxis = new NumericAxis();
 numericAxis.IsLabelCullingEnabled = false

 // XAML Example
 <s:NumericAxis IsLabelCullingEnabled="False"/>
Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178
  • Thanks, that solved it! Do you also happen to know how to get the labels below the axis? I've tried everything I could think of - vertical/horizontal alignment, anchor points, TranslateTransform where I tried to move both X and Y in every which way. I even tried stretching the labels by adding a lot of empty spaces to the strings. Nothing helped. Most things I tried didn't move the labels at all. Using moved them about 3 milimeters - in the wrong direction. – Shaggydog Apr 18 '16 at 07:24
  • I would guess (as your AxisLabelStyle is excluded from the question) that you have used RenderTransform to rotate labels but should use LayoutTransform. If not correct, please open another question for it! – Dr. Andrew Burnett-Thompson Apr 18 '16 at 09:12
  • I did open another question, but you're right, I did use the RenderTransform, not LayoutTransform. The question deals with vertical placement, but also with horizontal placement of the labels. Maybe you could take a look at it? http://stackoverflow.com/questions/36688144/scichart-accurate-placement-of-rotated-axis-labels – Shaggydog Apr 18 '16 at 09:18
  • I've just tested this in our own code and you need to use LayoutTransform – Dr. Andrew Burnett-Thompson Apr 18 '16 at 09:29