Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCRTGraph for Java
 RTAlarmIndicator
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

hzhou111h

6 Posts

Posted - 17 Nov 2006 :  16:51:32  Show Profile  Reply with Quote
Which parameter will decide the distance between the RTAlarmIndicator and it's RTBarIndicator?

quinncurtis

1586 Posts

Posted - 17 Nov 2006 :  18:13:04  Show Profile  Reply with Quote
There is no parameter for that because the RTAlarmIndicator position does not use the width of the associated RTBarIndicator as a reference. Instead, the RTAlarmIndicator symbols will always be on the outside edge of the plotting area of the coordinate system the bar is placed in. That way the bar can be the full width of the plotting area and not draw over the alarm indicator symbols. If you want more room between the bar and the alarm indicator symbol, make the bar narrower.
Go to Top of Page

hzhou111h

6 Posts

Posted - 21 Nov 2006 :  15:47:23  Show Profile  Reply with Quote
I don't want more room between the bar and the alarm indicator symbol. I want the alarm indicator symbol to be on the edge of the bar. I copied and paste your code for vertical, and convert it to horizontal, then the alarm indicator symbol is far away from the edge of the bar. I tested by "try and error" to change every possible parameter for many many hours. I just could not make the alarm indicator symbol to be on the edge of the bar.

private void InitializePIDBargraph()
{
ChartView chartVu = this;
Font numericFont = font18Numeric;
Font tagFont = font10;
ChartAttribute attrib1 = new ChartAttribute (Color.green, 1,ChartConstants.LS_SOLID, Color.green);
double barwidth = 50.0, barbase = 0.0;
int barjust = ChartConstants.JUSTIFY_MIN;
//int barorient = ChartConstants.VERT_DIR;
int barorient = ChartConstants.HORIZ_DIR;
ChartAttribute panelmeterattrib = new ChartAttribute(steelBlue,3,ChartConstants.LS_SOLID, Color.black);
ChartAttribute paneltagmeterattrib = new ChartAttribute(steelBlue,3,ChartConstants.LS_SOLID, Color.white);
// ChartAttribute rectattrib = new ChartAttribute(steelBlue,3,ChartConstants.LS_SOLID, steelBlue);

double x1=0.0, x2 = 1.0;
double y1 = 0.0, y2 = 1.0;
double faceplatewidth = 0.095;
double faceplateheight = 0.24;
double leftmargin = 0.055;
double rightmargin = 0.02;
double topmargin = 0.07;
double bottommargin = 0.07;
double xoffset = 0.6;
double yoffset = 0.05;
CartesianCoordinates pTransform1;

x1 = xoffset;
y1 = yoffset;
x2 = x1+faceplatewidth;
y2 = y1+faceplateheight;

double mindisplayvalue = PIDProcessItems.getDefaultMinimumDisplayValue();
double maxdisplayvalue = PIDProcessItems.getDefaultMaximumDisplayValue();
System.out.println(mindisplayvalue + " " + maxdisplayvalue);
//pTransform1 = new CartesianCoordinates( 0.0, mindisplayvalue, 1.0, maxdisplayvalue);

pTransform1 = new CartesianCoordinates(0.0, 0.0, 100.0, 100.0);

// ChartRectangle2D normrect = new ChartRectangle2D(x1, y1, faceplatewidth, faceplateheight);
// RT3DFrame frame3d = new RT3DFrame(pTransform1, normrect, rectattrib, ChartConstants.NORM_GRAPH_POS);
// chartVu.addChartObject(frame3d);

// x1 += leftmargin;
// y1 += topmargin;
// x2 -= rightmargin;
// y2 -= bottommargin;
// System.out.println("AAAAA " + x1 + " " + y1 + " " + x2 + " " + y2);
// pTransform1.setGraphBorderDiagonal(x1, y1, x2, y2) ;
//pTransform1.setGraphBorderDiagonal(0.56, 0.3, 0.9, 0.5) ;
pTransform1.setGraphBorderDiagonal(0.56, 0.5, 0.9, 0.7) ;

//pTransform1.setGraphBorderDiagonal(0.65, 0.075, 0.88, 0.15) ;

{
Background gbackground = new Background( pTransform1, ChartConstants.GRAPH_BACKGROUND, Color.white);
chartVu.addChartObject(gbackground);
}
// Background background = new Background( pTransform1, ChartConstants.PLOT_BACKGROUND, Color.black);
// chartVu.addChartObject(background);

LinearAxis baraxis = new LinearAxis(pTransform1, ChartConstants.X_AXIS);
chartVu.addChartObject(baraxis);

NumericAxisLabels barAxisLab = new NumericAxisLabels(baraxis);
chartVu.addChartObject(barAxisLab);

RTBarIndicator barplot = new RTBarIndicator(pTransform1,
PIDProcessItems, barwidth, barbase,
attrib1, barjust, barorient);

barplot.setIndicatorBackground( new ChartAttribute(Color.black, 1, ChartConstants.LS_SOLID, Color.black));


RTAlarmIndicator baralarms = new RTAlarmIndicator(baraxis, barplot);
baralarms.setLocation(50.0, 50.0); //no effect???
chartVu.addChartObject(baralarms);

RTNumericPanelMeter panelmeter = new RTNumericPanelMeter(pTransform1, panelmeterattrib);
panelmeter.setPanelMeterPosition( ChartConstants.OUTSIDE_PLOTAREA_MIN);
panelmeter.getNumericTemplate().setTextBgMode( true);
panelmeter.setTextColor( brightGreen);
panelmeter.getNumericTemplate().setTextFont( numericFont);
panelmeter.getNumericTemplate().setDecimalPos( 0);
panelmeter.setAlarmIndicatorColorMode( ChartConstants.RT_TEXT_BACKGROUND_COLOR_CHANGE_ON_ALARM);
panelmeter.setContrastTextAlarmColor( Color.white);
//panelmeter.setContrastTextAlarmColor( Color.yellow);
barplot.addPanelMeter(panelmeter);

RTAlarmPanelMeter panelmeter2 = new RTAlarmPanelMeter(pTransform1, panelmeterattrib);
panelmeter2.setPanelMeterPosition( ChartConstants.BELOW_REFERENCED_TEXT);
panelmeter2.getAlarmTemplate().setTextBgMode( true);
panelmeter2.setTextColor( brightGreen);
panelmeter2.getAlarmTemplate().setTextFont( font10Bold);
panelmeter2.setPositionReference( panelmeter);
panelmeter2.setAlarmIndicatorColorMode( ChartConstants.RT_TEXT_BACKGROUND_COLOR_CHANGE_ON_ALARM);
//barplot.addPanelMeter(panelmeter2);

RTStringPanelMeter panelmeter3 = new RTStringPanelMeter(pTransform1, paneltagmeterattrib, ChartConstants.RT_TAG_STRING);
panelmeter3.setPanelMeterPosition( ChartConstants.OUTSIDE_PLOTAREA_MAX);
panelmeter3.getStringTemplate().setTextBgMode( true);
panelmeter3.getStringTemplate().setColor( Color.black);
panelmeter3.getStringTemplate().setTextFont( tagFont);
panelmeter3.setPanelMeterNudge(0,0);
panelmeter3.setAlarmIndicatorColorMode( ChartConstants.RT_INDICATOR_COLOR_NO_ALARM_CHANGE);
//barplot.addPanelMeter(panelmeter3);

chartVu.addChartObject(barplot);

}


Go to Top of Page

quinncurtis

1586 Posts

Posted - 21 Nov 2006 :  16:39:41  Show Profile  Reply with Quote
WE SAID IN THE PREVIOUS POST, THE RTBarIndicator DOES NOT POSITION INSIDE THE PLOT AREA, NEXT TO THE BAR. IT IS POSITIONED OUTSIDE OF THE PLOT AREA, NEXT TO THE MAXIMUM EDGE.

We have no idea why you spent many hours, using trial and error to accomplish this. You should have spent 10 minutes creating a simple example program that demonstrated your problem. You should be able to start with our BarApplication1 example program. It displays a single RTBarIndicator, next to an RTAlarmIndicator. The alarm indicator is right up against the bar indicator, because the bar has a width of 1.0, and the pTransform1 Cartesian coordinate system the bar is placed has been scaled to a width of 1.0.

We can only guess that you have scaled your bar coordinate system for (0-100, 0-100), but your bar width is only 50, filling only half the plot area. If you want the bar indicator to fill the entire height of the plot area, you must use a bar width of 100, given your scale.

DO NOT POST LARGE CODE BLOCKS LIKE YOU DID - IT MAKES THE THREAD UNREADABLE. IF YOU HAVE TO POST MORE THAN 20-30 LINES, YOU HAVE NOT ISOLATED THE PROBLEM ENOUGH. IF WE THINK WE NEED MORE CODE WE WILL ASK THAT YOU SEND US A COMPLETE EXAMPLE PROGRAM.
Go to Top of Page

hzhou111h

6 Posts

Posted - 05 Dec 2006 :  09:38:53  Show Profile  Reply with Quote
The example that you mentioned does not help. The example is a vertical bar. I could not convert it to a horizontal bar by simply replacing ChartObj.VERT_DIR to ChartObj.HORIZ_DIR, I have to do too many other detail replacing jobs.

Because I could not find an example of horizontal bar with indicator on the edge in your example set. I used your example of
vertical bar with indicator on the edge of the bar, and convert it to a horizontal bar. It is not just a simple replacement of ChartObj.VERT_DIR by ChartObj.HORIZ_DIR. Many other tedious jobs were involved. While these tedious work fixed many other issues, I am not able to fix the problem of the indicator far away from the bar.

I followed your instruction here to re-exam my example. I assume this line of the code "pTransform1 = new CartesianCoordinates(0.0, 0.0, 100.0, 100.0);" is what you mean the coordinate system of 0 - 100, and this line of the code "baralarms.setLocation(50.0, 50.0);" is what you mean "the bar width is only 50". So I change "baralarms.setLocation(50.0, 50.0);" to "baralarms.setLocation(100.0, 100.0);" I found that it has the same effect (no change in the graph). In fact, I can simply delete this line "baralarms.setLocation(50.0, 50.0);" to get the same effect; or set "baralarms.setLocation(0.0, 0.0);" to get the same effect.
Go to Top of Page

hzhou111h

6 Posts

Posted - 05 Dec 2006 :  10:01:20  Show Profile  Reply with Quote
I eventually found that I should make the variable xyz to be 100 in the following instanciation:

new RTBarIndicator(pTransform1, PIDProcessItems, xyz, barbase,
attrib1, barjust, barorient);
Go to Top of Page

quinncurtis

1586 Posts

Posted - 05 Dec 2006 :  10:21:36  Show Profile  Reply with Quote
Since your xyz parameter is the bar width of the RTBarIndicator, what you did is exactly what we said to do a couple of week ago: "If you want the bar indicator to fill the entire height of the plot area, you must use a bar width of 100, given your scale."
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07