This is a migrated thread and some comments may be shown as answers.

Scatter Line Chart with X and Y value binding with Logarithmic axis

1 Answer 88 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
sandeep
Top achievements
Rank 1
sandeep asked on 11 Nov 2014, 07:20 AM
Hi,

I need some code which can render a Scatter line plot with x and y value and both the axis are logarithmic.

Thanks & Regards,
Sandeep Kumar Vidiyala

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 13 Nov 2014, 01:37 PM
Hi Sandeep,

You can take a look at the Scatter Series and the LogarithmicAxis SDK Examples as a reference for creating an example with ScatterSeries and two logarithmic axes.

I also prepared few snippets demonstrating such data binding scenario.

<telerik:RadCartesianChart>         
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LogarithmicAxis/>
    </telerik:RadCartesianChart.VerticalAxis>
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:LogarithmicAxis/>
    </telerik:RadCartesianChart.HorizontalAxis>
 
    <telerik:ScatterLineSeries ItemsSource="{Binding}" XValueBinding="XValue" YValueBinding="YValue" />
</telerik:RadCartesianChart>

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
 
        var source = new ObservableCollection<DataItem>()
        {
            new DataItem() { XValue = 10, YValue = 1000000 },
            new DataItem() { XValue = 100, YValue = 100000 },
            new DataItem() { XValue = 1000, YValue = 10000 },
            new DataItem() { XValue = 10000, YValue = 1000 },
            new DataItem() { XValue = 100000, YValue = 100 },
            new DataItem() { XValue = 1000000, YValue = 10 },
        };
        this.DataContext = source;
    }
}
 
public class DataItem
{
    public double XValue { get; set; }
    public double YValue { get; set; }
}

I hope this helps.

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ChartView
Asked by
sandeep
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or