We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

MultiChart

Thread ID:

Created:

Updated:

Platform:

Replies:

106647 Jan 20,2013 09:58 AM Jan 22,2013 04:57 AM WPF 2
loading
Tags: Chart
chuyanli
Asked On January 20, 2013 09:58 AM

    Hello,Recently I'm using the syncfusion to develop a product,but I'm in troblem with the using of syncfusion  chart control.Could you help me to solve it?Thank you very much.
   There is a chart and a start button on the window, the chart will display five lines. When I click the start button, the five lines in the chart will be refreshed automaticlly. 
   To realize the refreshment of the chart, I set a Timer, it's interval is set to 100ms, when I click the start button, the timer is enabled, so the five lines is refreshed every 100ms.
   The data of the five lines are fetched from a data acquisition card, I named it data[10000], among it 
the data[0] to data[19999] is the y-axis data of point 1 to point 20000 of line 1, 
the data[20000] to data[39999] is the y-axis data of point 1 to point 20000 of line 2, 
the data[40000] to data[59999] is the y-axis data of point 1 to point 20000 of line 3, 
the data[60000] to data[79999] is the y-axis data of point 1 to point 20000 of line 4, 
the data[80000] to data[99999] is the y-axis data of point 1 to point 20000 of line 5,
   For the second time, data[100000] refreshed ,so 
the data[0] to data[19999] is the y-axis data of point 20001 to point 40000 of line 1, 
the data[20000] to data[39999] is the y-axis data of point 20001 to point 40000 of line 2, 
the data[40000] to data[59999] is the y-axis data of point 20001 to point 40000 of line 3, 
the data[60000] to data[79999] is the y-axis data of point 20001 to point 40000 of line 4, 
the data[80000] to data[99999] is the y-axis data of point 20001 to point 40000 of line 5, 
   and so on.
   The original x-axis is 0-19999, when timer started the x-axis is automaticlly changed with the enlargement of datas, is 20000-39999, then 40000-59999, 60000-79999 and so on.
   The data[100000] is refreshed every timer span, and the 20000 points of 5 lines is refreshed ,the x-axis is also enlarged.
   But when  I programming as the above method , the running result is not so ideal, almost serval seconds to refresh the screen, the refresh speed is too low, and this speed I cannot accept at all, but I don't know where the problem is , and I don't know how to improve the program . I have read all the examples, and still don't know . 
   The following is my program . For making the data easy, I use the random data to take the place of my data acquisition cart data. 
   Could you help me ?  I'm very worry . I hope I can get your answer as soon as possible. Thank you.


[XAML]
 window.xaml

            <syncfusion:Chart>
                <syncfusion:ChartArea Header="Data Acquisition">

                    <syncfusion:ChartArea.PrimaryAxis>
                         <syncfusion:ChartAxis Header="Points-X"/>
                    </syncfusion:ChartArea.PrimaryAxis>
                    
   <syncfusion:ChartArea.SecondaryAxis>
                         <syncfusion:ChartAxis Header="Points-Y"/>
                    </syncfusion:ChartArea.SecondaryAxis>

     <syncfusion:ChartSeries  Name="ser1" DataSource="{StaticResource power}"   BindingPathX="X"    BindingPathsY="Y1"/>                       
   <syncfusion:ChartSeries  Name="ser2" DataSource="{StaticResource power}"   BindingPathX="X"    BindingPathsY="Y2"/>      
   <syncfusion:ChartSeries  Name="ser3" DataSource="{StaticResource power}"   BindingPathX="X"    BindingPathsY="Y3"/>      
   <syncfusion:ChartSeries  Name="ser4" DataSource="{StaticResource power}"   BindingPathX="X"    BindingPathsY="Y4"/>      
   <syncfusion:ChartSeries  Name="ser5" DataSource="{StaticResource power}"   BindingPathX="X"    BindingPathsY="Y5"/>      

                </syncfusion:ChartArea>
           </syncfusion:Chart>
           <Button Grid.Row = "1"  Name="Start" Click = "Start to refresh"/>

[C#]
 window.cs
private Timer timer;

public class PowerCollection : ObservableCollection<Power>
  {
        public PowerCollection ()
        {
          X {get;set};
      Y1{get;set};
Y2{get;set};
Y3{get;set};
Y4{get;set};
Y5{get;set};
        }
    }
        
Start to refresh //When the Start button clicked 
{
    timer = new Timer();
timer.interval=100;
timer.Tick+=new system.EventHandler(timer_Tick);
timer.enable=true;
}

void timer_Tick()
{
public ObservableCollection<Power> power = new ObservableCollection<Power>;
        public rand = new random();
for(int i=0;i<20000;i++)
{
    power.Add{X= i,Y1 = rand.Next(0,10), Y2 = rand.Next(10,20), Y3 = rand.Next(20,30),  Y4 = rand.Next(30,40), Y5 = rand.Next(40,50)}
}
        
        ser1.DataSource = this.power;
ser2.DataSource = this.power;
ser3.DataSource = this.power;
ser4.DataSource = this.power;
ser5.DataSource = this.power;
}


chuyanli
Replied On January 21, 2013 07:34 AM

  I have made a testing program to show my question, please see the attachment.

  In this example, the chart refreshing speed is too slow, almost two or three seconds to refresh for one time.
 
  How to improve the codes to make the chart refreshing faster? I want it to be less than 500 miliseconds.
 
  Thank you very much!


SyncfusionChartTest_eba916ee.rar

Sheik Syed Abthaheer M [Syncfusion]
Replied On January 22, 2013 04:57 AM

Hi Chuyanli,

Thanks for using Sycfusion Product.

 

We have analyzed your reported query and we would like to inform you that, you can achieve your problem by applying ChartArea.BeginInit() and ChartArea.EndInit() method when DataSource dynamically add to the ChartSeries as shown in the following code Snippet

Code Snippet [C#]:

 this.Graph1.Areas[0].BeginInit();

 ser1.DataSource = this.power;

 ser2.DataSource = this.power;

 ser3.DataSource = this.power;

 ser4.DataSource = this.power;

 ser5.DataSource = this.power;

 ser6.DataSource = this.power;

 ser7.DataSource = this.power;

 ser8.DataSource = this.power;

 this.Graph1.Areas[0].EndInit();

 

when using Random generate Number it takes small bit of time to calculate the number. Using many ChartSeries, it takes some times to initialize. You can use BeginInit() and EndInit() Method to reduce some initiation  time.

Please let us know if you have any query.

 

Regards, 

M. Sheik Syed Abthaheer


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;