Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
XamDataChart - Y axis scaling
posted

Hi

    I have different series added to Xamdatachart but not all series are visible at same time. What I have observed that Y axis is scaling for all data points in the series but not to the points corresponding to the visible series. 

   Any suggestions or setting how this can be achieved.

Thanks

Sunil

Parents
No Data
Reply
  • 2520
    Offline posted

    Hello Sunil,

    I believe you are using the XamDataChart component of the Ultimate UI for WPF Suite, aren't you? I am asking this since this is the JQuery forum, however, the question is asked about the XamDataChart. Please, note that WPF posts can be found in its dedicated forum section.

    The Axis Range can be manually configured. More details can be found in our documentation here.

    For instance, when toggling the visibility of certain series, the greatest value of the corresponding series member could be retrieved and assigned to the MaximumValue property. Please, note that how this is achieved has to be implemented on application level. Additionally, in case there are multiple series, the maximum value has to be determined taking all of them into account.

    For example for the following series:

    <ig:ColumnSeries ItemsSource="{Binding Path=Data}"
                                     ValueMemberPath="Coal"
                                     Visibility="{Binding ElementName=columnCb, Path=IsChecked, Converter={StaticResource conv}}"
                                     Title="Coal"
                                     XAxis="{Binding ElementName=xAxis}"
                                     YAxis="{Binding ElementName=yAxis}"></ig:ColumnSeries>

    Once the visibility is toggled based on some custom condition, the NumericYAxis MaximumValue could be set as follows:

    var maxVal = (this.DataContext as ViewModel).Data.OrderByDescending(d => d.Coal).First().Coal;
    
    (this.xdc.Axes["yAxis"] as NumericYAxis).MaximumValue = maxVal;

    An even more straightforward solution, though, would be simply adding and removing the series instead of toggling their visibility. This is because the XamDataChart’s numeric Y axis will automatically scale according to the present series. One thing to keep in mind is the Z-Index order when dynamically adding/removing series, nevertheless, this could also easily be configured in code.

    For your convenience, I prepared a minimal sample demonstrating the latter suggestion. Please, test it on your side and if you require any further assistance on the matter, please, let me know.

    Best regards,
    Bozhidara Pachilova
    Associate Software Developer

    2084.XDCSample.zip

Children
No Data