Hello,
is it possible to display the maximum values of the axis in the chart?
See attached image.
Hi Markus,
Thank you for posting in our forums!
The axis labels are displayed based on your axis.Interval property. You can set the Interval to a number evenly divisible by the maximum value if you would like to display the max values.
If you have any further questions or concerns with this, please let me know.
Hi,
you can implement a derived class CustomTickmarkValues from Infragistics.Controls.Charts.TickValues like below. The only thing is that I didn't find a way to avoid having to re-implement the 'normal' assigned tickvalues and just add the axis maximum to the tickvalues. That's what all that "orderOfMagnitude" code is about.
=================================================
public class CustomTickmarkValues : TickmarkValues { List<double> _majorvalues;
List<double> _minorValues;
public double MinimumDisplayValue => _majorvalues.First();
public double MaximumDisplayValue => _majorvalues.Last();
List<double> GetTicks(double minimumDisplayValue, double maximumDisplayValue, int ticksCount) { List<double> ticks = new List<double>(); double proposedMajorTickRange = (maximumDisplayValue - minimumDisplayValue) / (double)ticksCount;
double orderOfMagnitude = Math.Round(Math.Log10(proposedMajorTickRange), 0); double proposedTickRange = Math.Pow(10, orderOfMagnitude);
double multiplicationFactor = Math.Max(1, Math.Round(proposedMajorTickRange / proposedTickRange, 0));
double tickRange = multiplicationFactor * proposedTickRange;
double minimumTickValue = Math.Floor(minimumDisplayValue / tickRange) * tickRange;
double runningValue = minimumTickValue; while (runningValue <= maximumDisplayValue) { ticks.Add(runningValue);
runningValue += tickRange; } return ticks; }
public CustomTickmarkValues(double? minimumDataValue, double? maximumDataValue ,int ticksCount) { _minorValues = new List<double>();
if (minimumDataValue == maximumDataValue) { double singleValue = minimumDataValue ?? 0.0;
_majorvalues = new List<double>() { singleValue - 0.1, singleValue + 0.1 }; } else { _majorvalues = GetTicks(minimumDataValue.Value, maximumDataValue.Value, ticksCount); } }
private static int GetProposedTicksCount(double minimumValue, double maximumValue, double proposedMajorTickRange) {
int count = (int)((maximumValue - minimumValue) / proposedMajorTickRange);
return count; }
/// <summary> /// Returns values of major tickmarks /// </summary> /// <returns></returns> public override IEnumerable<double> MajorValues() { return _majorvalues; }
/// <summary> /// Returns values of minor tickmarks /// </summary> /// <returns></returns> public override IEnumerable<double> MinorValues() { return _minorValues;
} }
Thank you for sharing your solution, Arjan.
This helped me find the following documentation on setting custom tickmarks that I had missed previously.
https://www.infragistics.com/help/wpf/datachart-creating-custom-axis-tickmark-values
This helps show how Arjan's solution can be applied to the chart.
Thanks. That's what I am looking for.