Plot Trend Graph

Discussion of application development using iX Developer, including but not limited to getting started, using the functions tab, properties, objects and installation.
umesh.patil
Posts: 15
Joined: Mon Dec 05, 2011 12:25 am

Plot Trend Graph

Post 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.

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Plot Trend Graph

Post 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.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

bjornidar
Posts: 49
Joined: Thu Nov 17, 2011 2:10 am
Location: Norway
Contact:

Re: Plot Trend Graph

Post 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?

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Plot Trend Graph

Post 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.
Attachments
Script_Database_Export.zip
(189.96 KiB) Downloaded 981 times
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

bjornidar
Posts: 49
Joined: Thu Nov 17, 2011 2:10 am
Location: Norway
Contact:

Re: Plot Trend Graph

Post 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.
Last edited by bjornidar on Thu Jun 07, 2012 1:01 am, edited 1 time in total.

memethemyn
Posts: 51
Joined: Fri Apr 27, 2012 12:33 pm

Re: Plot Trend Graph

Post by memethemyn »

Dear Mark

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

What will be the problem :(

Thanks

bjornidar
Posts: 49
Joined: Thu Nov 17, 2011 2:10 am
Location: Norway
Contact:

Re: Plot Trend Graph

Post 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 :)
Attachments
Script_Database_Export_2.0.zip
(197.57 KiB) Downloaded 1061 times

memethemyn
Posts: 51
Joined: Fri Apr 27, 2012 12:33 pm

Re: Plot Trend Graph

Post 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..

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Plot Trend Graph

Post 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 27297 times
Snap 2012-06-07 at 07.48.11.jpg
Snap 2012-06-07 at 07.48.11.jpg (51.06 KiB) Viewed 27297 times
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

bjornidar
Posts: 49
Joined: Thu Nov 17, 2011 2:10 am
Location: Norway
Contact:

Re: Plot Trend Graph

Post by bjornidar »

Will this work with historical values as well?

Post Reply