Page 1 of 2

Plot Trend Graph

Posted: Wed Mar 28, 2012 6:43 am
by umesh.patil
Hi,

I am using T7a.
I want to show graph on trend through whatever value I have stored in Data Base. I am able to create database write values and read them. I am unable to plot graph on trend through those stored values.

Re: Plot Trend Graph

Posted: Wed Mar 28, 2012 2:28 pm
by mark.monroe
That feature will be available in iX Developer 2, but is currently not available in iX Developer 1.3X. We expect iX Developer 2 to be available within the next few months. However, in 2.0 you will still need to write a C# script to do it.

We can help you with any 2.0 scripting questions you might have once the software is released.

Re: Plot Trend Graph

Posted: Wed Jun 06, 2012 3:36 am
by bjornidar
I'm now trying to develop this with iX 2.0, for now - just testing to see if I can store an operators trends and bring them back up to read the values.

What I've done is that I've stored the following lines in a text document;

Code: Select all

Globals.Tags.Trend11.Value
Globals.Tags.Trend12.Value
Globals.Tags.Trend13.Value
Now, when reading the text file into an array and put them in an AnalogNumeric foreach line, I get the correct tag. But it does not seem like the application understands that it is a tag?

Code: Select all

		void Button1_Click(System.Object sender, System.EventArgs e)
		{
			string trendpen;
			string filePath = "";
			string line;
			
			List<String> stringArr = new List<string>();
			
			try 
			{
				trendpen = this.ComboBox1.SelectedItem.ToString();
			
				filePath = @"" + trendpen + "";
			}
			catch
			{
				MessageBox.Show("Finner ikke angitt trend-fil. Velg fra nedtreksmenyen", "Feil i valg av trend", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
			}
			if (File.Exists( filePath ))
			{
				
				StreamReader file = null;
				try
				{
					file = new StreamReader( filePath );
					while ((line = file.ReadLine()) != null)
					{
						stringArr.Add(line);						
					}
				}
				finally
				{
					if (file != null)
						file.Close();
				}
			
			}
			else
			{
				MessageBox.Show("Finner ikke angitt trend-fil. Velg fra nedtreksmenyen", "Feil i valg av trend", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
			}
			if(stringArr.Count >= 1)
			{
				AnalogNumeric1.Value = stringArr[0];
			}
			if(stringArr.Count >= 2)
			{
				AnalogNumeric2.Value = stringArr[1];
			}
			if(stringArr.Count >= 3)
			{
				AnalogNumeric3.Value = stringArr[2];
			}
 
		}
Maybe there is a functionality in 2.0 that does this for me, and also gives the oportunity to fetch "history" values as well?

Re: Plot Trend Graph

Posted: Wed Jun 06, 2012 7:15 am
by mark.monroe
Normally I would use a DataLogger to log the changes. Then use a script to access the data in the database. The Script_Database_Export project attached shows you how to query the database.

If all you want to do is plot a graph of the data, then you can have the Trend chart save a history of the data it is plotting. There is an action that you can assign to a button that allows you to change the time range for the data that you are plotting. That way when the Trend chart history is turned on, you can select what time range you want the trend chart to plot.

Re: Plot Trend Graph

Posted: Thu Jun 07, 2012 12:07 am
by bjornidar
It won't acctually log changes, rather creation of new trends with it's curves(?)
What I'm looking for is a script that makes it possible to create a new trend, with curves chosen during runtime, and be able to choose which of the generated trends to display.

Re: Plot Trend Graph

Posted: Thu Jun 07, 2012 12:45 am
by memethemyn
Dear Mark

I couldn't open the example project in ix 2.0 :(

What will be the problem :(

Thanks

Re: Plot Trend Graph

Posted: Thu Jun 07, 2012 1:03 am
by bjornidar
memethemyn wrote:Dear Mark

I couldn't open the example project in ix 2.0 :(

What will be the problem :(

Thanks
You will have to open the project in iX 1.3x -> change the panel type and then open it in iX 2.0.
I could do it for you? - I dit it for you :)

Re: Plot Trend Graph

Posted: Thu Jun 07, 2012 3:10 am
by memethemyn
bjornidar wrote:
memethemyn wrote:Dear Mark

I couldn't open the example project in ix 2.0 :(

What will be the problem :(

Thanks
You will have to open the project in iX 1.3x -> change the panel type and then open it in iX 2.0.
I could do it for you? - I dit it for you :)
Dear bjornidar

Thank you much..

Since I installed the 2.0 I had unınstalled the 1.3 :) But seems to install again..

Thanks again..

Re: Plot Trend Graph

Posted: Thu Jun 07, 2012 6:52 am
by mark.monroe
Hi memethemyn,

It sounds like you want to use a Chart. You assign an array tag for the X and Y axis. Then whatever values are in those arrays gets plotted. If you are using data from the database, you will first need to query the database and get the data you want, then put that data in the array tags. The Chart will then plot the data. There are many different kinds of charts that you can use. In the "Chart Settings" you can change the chart type. They have line charts, so you can make it look like a Trend Chart.
Snap 2012-06-07 at 07.51.21.jpg
Snap 2012-06-07 at 07.51.21.jpg (38.49 KiB) Viewed 27287 times
Snap 2012-06-07 at 07.48.11.jpg
Snap 2012-06-07 at 07.48.11.jpg (51.06 KiB) Viewed 27287 times

Re: Plot Trend Graph

Posted: Thu Jun 07, 2012 7:01 am
by bjornidar
Will this work with historical values as well?