why points donot display

2 posts, 0 answers
  1. Wpf
    Wpf avatar
    1 posts
    Member since:
    Nov 2012

    Posted 24 Dec 2014 Link to this post

    here is the xaml:
    <telerik:RadCartesianChart x:Name="Chart">
                <telerik:RadCartesianChart.VerticalAxis>
                    <telerik:LinearAxis/>
                </telerik:RadCartesianChart.VerticalAxis>
                <telerik:RadCartesianChart.HorizontalAxis>
                    <telerik:CategoricalAxis/>
                </telerik:RadCartesianChart.HorizontalAxis>
               
                <telerik:RadCartesianChart.Series>
                    <telerik:ScatterPointSeries XValueBinding="Category" YValueBinding="Value" ItemsSource="{Binding}">
                        <telerik:ScatterPointSeries.PointTemplate>
                            <DataTemplate>
                                <Ellipse Width="10" Height="10" Fill="{Binding DataItem.Color}"/>
                            </DataTemplate>
                        </telerik:ScatterPointSeries.PointTemplate>
                    </telerik:ScatterPointSeries>
                </telerik:RadCartesianChart.Series>
            </telerik:RadCartesianChart>

    the binding code is:
    public MainWindow()
            {
                InitializeComponent();
                DataContext = GetData(12);
            }        public static List<ChartData> GetData(int dataSize)
            {
                Random rnd = new Random();
                var result = new List<ChartData>();            for (int i = 0; i <= dataSize; i++)
                {
                    result.Add(new ChartData()
                    {
                        Category = i,
                        Value = rnd.Next(1, 100),
                        Color = new SolidColorBrush(
                            Color.FromArgb(255, (byte)rnd.Next(0, 256), (byte)rnd.Next(0, 256), (byte)rnd.Next(0, 256)))
                    });
                }            return result;
            }

    but when running app. the points is not show. pls Help.
         
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 25 Dec 2014 Link to this post

    Hi,

    As explained here the scatter series require two numeric axes. So you need to either use a LineSeries instead of the scatter line series or you need to use a numeric (LinearAxis or LogarithmicAxis) instead of the CategoricalAxis.

    Here are some valuable links:
    online qsf examples
    sdk samples

    Regards,
    Petar Marchev
    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top