DennisV Posted March 1, 2007 Report Share Posted March 1, 2007 Hello. I'm having difficulty getting the scrollbar to show for the X-Axis. I've modified the AxisLabels sample application with the following XML resource file to read in. It provides me with 100 data points. I'm trying to set up the XAxis as a time based scale. The major ticks are every 5 seconds. Does the Step value have anything to do with why I can't get the scroll bar? Here is the ReadChartData() void ReadChartData(){ //string sXmlData = Properties.Resources.ProductSales; string sXmlData = Properties.Resources.TimeTest; XmlDataProvider cfxXML = new XmlDataProvider(); cfxXML.DateFormat = "MM/dd/yyyy HH:mm:ss"; cfxXML.LoadXml(sXmlData); try { chart1.ExtraStyle |= ChartStyles.DoubleBuffer; chart1.Gallery = Gallery.Curve; chart1.AxisX.LabelAngle = 45; chart1.AxisX.Step = 5.787037083e-5; chart1.AxisX.MinorStep = 1; chart1.AxisX.LabelsFormat.Format = AxisFormat.Time; chart1.DataSourceSettings.DataSource = cfxXML; chart1.AxisX.AutoScroll = true; chart1.AxisX.ScrollPosition = 50; chart1.AxisX.SetScrollView(30, 40); } catch (Exception ex) { MessageBox.Show(DateTime.Now.ToString() + "\n\n" + ex.Source + ": " + ex.Message); }} Link to comment Share on other sites More sharing options...
Frank Posted March 1, 2007 Report Share Posted March 1, 2007 Only one problem with your code: chart1.AxisX.SetScrollView(30, 40); You have a true X/Y chart (line), instead of 30 and 40 you should be specifying DateTime values. Link to comment Share on other sites More sharing options...
DennisV Posted March 1, 2007 Author Report Share Posted March 1, 2007 First off, thank you for the response. I gave it a try and I must still be doing something wrong. I put the ScrollPosition = 50 and SetScrollView(30, 40) into the code earlier as guesses. Here is what I tried and still wasn't able to get the results. [*]Leave the code as it is. I can change the chart Gallery to Bar chart and the scroll bar does appear. I set the Gallery to Curve and the chart plots all data points onto the display. I would like to force it to show only a subset of the data, say 30 points. [*]Here is what I attempted with using a DateTime value.DateTime dtStart = DateTime.Parse("03/01/2007 08:43:09");DateTime dtEnd = DateTime.Parse("03/01/2007 08:43:29");//chart1.AxisX.SetScrollView(30, 40);chart1.AxisX.SetScrollView(dtStart.ToOADate(), dtEnd.ToOADate()); Running the SetScrollView with the DateTime values ran slow. Is that normal? It seemed like the appication may have been frozen up for about 5 seconds, then the display changed to grey, please see attached picture. If I were to right click on the chart and then disply the Toolbar the chart would refresh back to all data points on the display. Regards, Dennis Link to comment Share on other sites More sharing options...
Ronak Posted March 9, 2007 Report Share Posted March 9, 2007 Hi, I am also having the Same Problem. In my case i have Lables on X axis. And when i tried to do SetScollView(0,5) on X axis, in order to show only first five lables and if user wants to see other he has to use scoll bar. My application went into freeze mode. Link to comment Share on other sites More sharing options...
Frank Posted March 12, 2007 Report Share Posted March 12, 2007 Remove the line: chart1.AxisX.MinorStep = 1; This is making it draw a label for every single point. When this is done I get the attached image. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.