This is a migrated thread and some comments may be shown as answers.
Bar Series does not redraw in iOS, Is there any method that can be used to refresh/redraw?
10 Answers 61 Views
This is a migrated thread and some comments may be shown as answers.
Ram Prasad
Top achievements
Rank 1
Ram Prasad asked on 03 May 2017, 09:30 AM

Hi,

We are using Xamarin forms controls of telerik UI for Xamarin.

Bar series in Charts is not rendering it's bars in iOS. This is a case where I first bind chart to a collection with Zero Values(for Numberic Axis) and change data of values to Non-Zero values, then it does not redraw Bars but it shows labels (data points) with updated numbers/values.

In other case, i.e., bind chart to collection with Non-zero values first then change to zero values, works fine.

 

I am able to reproduce this with your samples (SDKBrowser). Is there any way to force redraw bars??

 

Thanks,

Ram prasad

 

 

 

 

10 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 03 May 2017, 01:35 PM
Hi Ram,

Thank you for contacting us.

Indeed there is an issue where chart axis is not updated when the data has changed. I have logged it in our feedback portal where you can track its status. I have also added points to your account as a token of gratitude for bringing this issue to our attention.

As a workaround, you can reset the chart axis to force the chart to update its data.
chart.Series[0].ItemsSource = GetCategoricalData();
chart.VerticalAxis = new NumericalAxis();

Please, let us know if you have further questions.

Regards,
Rosy Topchiyska
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ram Prasad
Top achievements
Rank 1
answered on 11 Jul 2017, 10:55 AM

Hello, 

The above solution does not seem to work. Is there any fix or update on this issue?

Thanks,

Ram prasad

 

0
Ves
Telerik team
answered on 14 Jul 2017, 07:37 AM
Hi Ram,

Please, use the following approach -- clear the series source explicitly before assigning the new one:
chart.Series[0].ItemsSource = null;
chart.Series[0].ItemsSource = GetCategoricalData();
chart.VerticalAxis = new NumericalAxis();

In addition, please make sure you use the latest release -- version 2017.2.626.

Best regards,
Ves
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Thomas
Top achievements
Rank 1
answered on 24 Jul 2017, 08:19 AM

Hi Ves,

 

How would resetting the source work if the ItemSource is bound to an observable collection in Xaml?

 

Thanks

0
Lance | Manager Technical Support
Telerik team
answered on 25 Jul 2017, 06:42 PM
Hello Thomas,

You can set the binding programmatically as you would normally do in any XAML framework, using the DependencyProperty in the SetBinding method. In Xamarin.Forms, the SetBinding method is used as well, see the Xamarin.Forms documentation here.

The LineSeries object, inherits from ChartSeries (see the class hierarchy here). ChartSeries has a property named ItemsSource (the DependencyProperty is named ItemsSourceProperty).

Thus, you can use the following SetBinding implementation:

// In XAML <telerikChart:LineSeries x:Name="MyLineSeries"
//                                  ItemsSource = "{Binding DataItems}" >
 
// In C#
MyLineSeries.SetBinding(ChartSeries.ItemsSourcePropertynew Binding("DataItems"));


Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ganesh
Top achievements
Rank 1
answered on 07 Aug 2017, 09:36 AM

Hi,

I have the same issue, I am unable to show Bar graphs according to my Data from server.

I am adding the data to observable collection after server call in viewmodel, But the bar graphs are not drawing.

I am using the latest dll.

let me know how to update the bars according to the data after server call.

Thank you,

 

0
Lance | Manager Technical Support
Telerik team
answered on 07 Aug 2017, 06:55 PM
Hello Ganesh,

See Rosy's or  Ves's reply above, this is what you'll currently need to do in order to re-draw the series after an items update.

We are aware of the issue and are working on a fix that will be in an upcoming release. This is a high priority item and you can track the status of the issue here in our feedback portal.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Felix
Top achievements
Rank 1
answered on 30 Oct 2017, 02:50 PM

Hello,

I have the same problem but with the line chart and Android. If I change the ItemSource the chart is not updated. I'm using version 2017.3.1018.240. According to the feedback portal this bug should be fixed but it's still not working. Or am I missing something?

Kind regards,

Felix

0
Lance | Manager Technical Support
Telerik team
answered on 01 Nov 2017, 08:48 PM
Hi Felix,

I've asked for clarification from the dev team on exactly what the fix entailed. However, I can confirm that if you replace the collection, instead of using Clear() and Add() methods, it will now redraw the series.

Here is the example code from my attached demo:

<telerikChart:RadCartesianChart x:Name="chart">
    <telerikChart:RadCartesianChart.HorizontalAxis>
        <telerikChart:CategoricalAxis />
    </telerikChart:RadCartesianChart.HorizontalAxis>
    <telerikChart:RadCartesianChart.VerticalAxis>
        <telerikChart:NumericalAxis />
    </telerikChart:RadCartesianChart.VerticalAxis>
    <telerikChart:RadCartesianChart.Series>
        <telerikChart:BarSeries ItemsSource="{Binding Data}" CategoryBinding="Category" ValueBinding="Value" />
    </telerikChart:RadCartesianChart.Series>
</telerikChart:RadCartesianChart>

View model collection the series is bound to:

private ObservableCollection<CategoricalData> data;
 
public ObservableCollection<CategoricalData> Data
{
    get { return data; }
    set { data = value; OnPropertyChanged();}
}


View model method that updates the Data collection:

private void GenerateData()
{
    var items = new ObservableCollection<CategoricalData>();
 
    for (int i = 0; i < 5; i++)
    {
        items.Add(new CategoricalData
        {
            Category = $"Item {i}",
            Value = random.NextDouble()
        });
    }
 
    Data = items;
}

If you have any implementation specific questions, please open a support ticket here (you have a valid support license during your trial). We'll be able to follow up with you directly and continue the conversation there.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Felix
Top achievements
Rank 1
answered on 03 Nov 2017, 07:00 AM

Hello Lance,
thanks for your answer. I found the answer of my  problem. The problem was that I set the binding context inside the chart like in the line chart example of your documentation.

<telerikChart:RadCartesianChart x:Name="Chart">
          <telerikChart:RadCartesianChart.BindingContext>
                        <viewModels:ViewModel/>
           </telerikChart:RadCartesianChart.BindingContext>
</telerikChart:RadCartesianChart>

If I comment the binding context everthing works fine. Unfortunatly I don't know why this is a problem, because I'm quite new in the Xamarin Forms space.
Tags
Chart
Asked by
Ram Prasad
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Ram Prasad
Top achievements
Rank 1
Ves
Telerik team
Thomas
Top achievements
Rank 1
Lance | Manager Technical Support
Telerik team
Ganesh
Top achievements
Rank 1
Felix
Top achievements
Rank 1
Share this question
or