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

Dynamically adding data with a preset xaxis range

2 Answers 50 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brett Robichaud
Top achievements
Rank 1
Brett Robichaud asked on 12 Feb 2012, 07:33 PM
I am trying to create a line chart that will be filled in real-time over a 2hr time period. It will be something like PerfMon in that I will start with just 1 data point and each minute I will add a new one until I reach 2hrs, at which time the first data point is removed, and from then on I show the last 2hrs of data with the line data scrolling each minute.

I have made this work by simply adding to the list the chart is data bound to. But the xaxis changes every minute to accommodate the new data point, up until 2hrs. I'd like to preset the xaxis to show 2hrs in 1min increments even though I don't have data yet. Is this possible?

I thought about prefilling the databound list with values of 0, but then the line chart looks odd because it goes to zero for all future points. How else could I accomplish this?

2 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 15 Feb 2012, 03:44 PM
Hello,

Is it possible to set the AutoScale property of the XAxis to false initially with appropriate minimum and maximum? Then when the data gets populated with 2 hours, you can set it to true again.

Kind regards,
Petar Marchev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Brett Robichaud
Top achievements
Rank 1
answered on 15 Feb 2012, 03:55 PM
I actually decided on another approach that seems to work well enough. I preloaded the list my chart is bound to with empty values for the full 120 increments. Then I add to the end of the list as I get new data. This eliminates the problem I was seeing when I then added to the front of the list (the chart going to zero). The side effect of course is that the initial data slides in from the right hand side, but I am ok with that effect.

Thanks for the help.
Tags
Chart (obsolete as of Q1 2013)
Asked by
Brett Robichaud
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Brett Robichaud
Top achievements
Rank 1
Share this question
or