nativescript-community / ui-chart

A powerful chart / graph plugin, supporting line, bar, pie, radar, bubble, and candlestick charts as well as scaling, panning and animations.
https://nativescript-community.github.io/ui-chart/
Apache License 2.0
33 stars 12 forks source link

first render of an async PieChart broken on iOS #31

Closed wendt88 closed 3 years ago

wendt88 commented 3 years ago

Summary setting data asynchronous, PieChart does not render on first view (iOS only). By turning the screen off an on, it gets shown.

Example

const set = new PieDataSet([{
    label: 'foo',
    value: 1
}, {
    label: 'bar',
    value: 1.5
}], 'Test', 'value');
set.setColors(['green', 'red']);

// this works fine
chart.setData(new PieData([set]));

// this not
setTimeout(() => {
    chart.setData(new PieData([set]));
    chart.redraw(); // this line soves the problem
});

Device (please complete the following information):

Additional Context I don't know if this bug is related to this library or from some other part (@nativescript-community/ui-canvas or the core library) On Android and any other chart type it works very well

farfromrefug commented 3 years ago

@wendt88 that s normal. Out of better performance you are responsible for callingredraw. Was working without the timeout because you set before a render triggered by the system.