I'm using your advice to generate TickmarkValues scope.
http://help.infragistics.com/Help/NetAdvantage/WPFDV/2011.2/CLR4.0/html/xamDataChart_Creating_Custom_Axis_Scalers.html
I wanna render 10 TickmarkValues for my chart, so my overridden method returns 10 Double values, but Axis renders random number of tickmarks. I tried to play around TickmarkValuesInitializationParameters before initialization, but no results.
Any ideas?
Hello Artem,
I have been looking into your code and I tested it and I can say that the Values in the collection always are 10, depending on the MaxValue sometimes the thickmark values are very close or equals and this is why you have different number of thick marks every time. You can put a Breakpoint before you return the collection of thickmarks and you will notice the values.
Hope this helps you.
I'm using numericY axis and my MaxValue of the axis is dependency property - so it's not pre-defined. My Min value is always 0. The numericY axis is logarithmic.
I wanna render Y axis tickmarks with the same distance between tickmarks labels, like in non logarithmic axis. Here is the code that calculates the array of points to render:
public class CustomTickmarkValues : TickmarkValues { private double _min; private double _max; public override void Initialize(TickmarkValuesInitializationParameters initializationParameters) { base.Initialize(initializationParameters); _min = 0; _max = initializationParameters.VisibleMaximum; } public override IEnumerable<double> MajorValues() { var a = Math.Log10(_max)/8; var collection = new List<double>(); collection.Add(_min); for (int i = 1; i<= 8; i++) { collection.Add((int)Math.Pow(10, i * a)); } collection.Add(_max); return collection; } public override IEnumerable<double> MinorValues() { return new List<double>(); } }
This code generates for me 8 values, then i add max and min values - so it should be 10, but as you can see sometimes its not 10:
For both chart code is the same.
this is my axis xaml code:
<ig:NumericYAxis x:Name="xmMaxYAxis" IsLogarithmic="True" Stroke="Transparent" MajorStroke="Transparent" MaximumValue="{Binding MaxVal}"> <ig:NumericYAxis.LabelSettings> <ig:AxisLabelSettings Location="OutsideRight" TextAlignment="Left" Visibility="Visible" Foreground="LightSeaGreen" /> </ig:NumericYAxis.LabelSettings> <ig:NumericYAxis.TickmarkValues> <local:CustomTickmarkValues /> </ig:NumericYAxis.TickmarkValues> </ig:NumericYAxis>
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Also I can say that the Axis’ MinimumValue must be less than the minimum tickmark and DataPoint’s Value and the MaximumValue must be greater than the biggest tickmark and DataPoint’s Value in order every time you can have all the tickmarks visible. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.