-1

C#, W7, VS2010 and Zedgraph.

In the Desktop App, has a numericUpDown ranging from 1 to 3300. Each 1 of the numericUpDown is equal 1 second. On ZedGraph, how to put this numericUpDown in Xaxis in this format 00:00~55:00, with an interval of 5 minutes?

Thanks in advance, pontes

user1635148
  • 49
  • 1
  • 3
  • 7
  • What have you tried so far? Please give as much information as possible in order to get useful help. – Olle Sjögren Sep 18 '12 at 09:01
  • In C# I used this code: int M_times=3198; myPane02m.XAxis.Scale.Min=0; myPane02m.XAxis.Scale.Max=(M_times/10)+2; myPane02m.XAxis.Type=AxisType.Ordinal; – user1635148 Sep 21 '12 at 06:18
  • Hi Olle Sjögren. I uploaded Sample Data and VBA code to this link: http://www.sendspace.com/file/3vroqd What you advise me to solve this problem? – user1635148 Sep 27 '12 at 01:08
  • I'm sorry, I still don't understand. You have a c# desktop application? And you want data from the application to update an Excel file? How do the application communicate with excel? You need to provide more details and keep your questions short and to the point for someone to help you. From what I understand of your question so far, I don't think I can help you. – Olle Sjögren Sep 27 '12 at 08:59
  • Sorry, the app save the data in Excel file. I have another question about VBA in Excel to make the same in Excel chart. Please forgive me, I got confused. – user1635148 Sep 27 '12 at 11:34

1 Answers1

0

what is the numericUpDown suposed to change in your XAxis? the maxScale value?, if so then add following code to the numericUpDown eventzedGraphControl1.GraphPane.XAxis.Scale.Max = numericUpDown1.Value

Pablo Elias
  • 102
  • 1
  • 2
  • 8
  • myPane02m.XAxis.Type = AxisType.Date; myPane02m.XAxis.Scale.Format = "mm:ss"; How to show only minutes and seconds in X axis? – user1635148 Oct 01 '12 at 19:19
  • try with XAxis.Scale.Format = "HH:mm:ss" (you will have also the hours but i cant find the format only for min and sec), the problem is the time representation of your x axis values, as much as i understand zedgraph time 0 is on 30.12.1899 at 00:00, and time 1 is 31.12.1899 at 00:00 the values between 0 and 1 are the hours of that day, so if you want to draw a point every second and you have integer values for your x axis you will have to scale them multiplicating with 0.000011574, and maybe adding days until today like this: – Pablo Elias Oct 02 '12 at 07:46
  • `x[i] = new XDate(DateTime.Today) + i * (0.000011574);` – Pablo Elias Oct 02 '12 at 07:46
  • n=numericUpDown - Thank you Pablo. I'm using this code: int M_times=n1+n2+n3; //This M_times represents seconds. Range=10-3200 or between 10 seconds and 3200 seconds. Has in my code this: myPane02m.XAxis.Type=AxisType.Ordinal;. I put your tip: myPane02m.XAxis.Scale.Format="HH:mm:ss"; However I don't know to use your next tip: x[i] = new XDate(DateTime.Today) + i * (0.000011574); Thankz – user1635148 Oct 08 '12 at 05:15
  • x is supossed to be an array with the values fpr ypur x Axis, x[i] should be i seconds, – Pablo Elias Oct 08 '12 at 06:52
  • myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = x; ? – user1635148 Oct 11 '12 at 00:41
  • was this supposed to be a question? – Pablo Elias Oct 11 '12 at 06:34
  • yes, what is the type of Array x[i]? int or double, the system – user1635148 Oct 12 '12 at 04:24
  • Yes, because in this line chart, the plot area will be a static. The X axis is filled with the time that is in int i variable. What is the type of Array x[i]? Where to put the X? myPane02m.XAxis.Type=AxisType.Ordinal; is OK? – user1635148 Oct 12 '12 at 04:33
  • X is an double array, you should use it to construct your points with the values that you want to put in your Y axis ( also a double array) Xaxis.Type = AxisType.Date is what i used here, but it could work with Ordinal too... – Pablo Elias Oct 12 '12 at 06:36