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
 MeterAxisLabels not showing
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic   

jimmclaughlin

1 Posts

Posted - 19 Aug 2005 :  11:54:12  Show Profile  Reply with Quote
Hi,
I've been trying out this library and so far I really dig it. I am having one problem, however. I have some RTMeters that are pretty much a cut and paste of the Humidity meter from the weather station example (com.quinncurtis.rtgraphjava.examples.weatherstation). It works great if the startarcscale and endarcscale are separated by a margin of at least 4.0, but less than that, the labels other than the first don't show. These are the startscale and endscales I am trying to show:

0.00 to 0.50
23.0 to 26.0
25.0 to 28.0
26.0 to 29.0
59.5 to 60.5

I would really appreciate some advice on how to scale the ticks for the labels to show properly

quinncurtis

1586 Posts

Posted - 19 Aug 2005 :  16:41:59  Show Profile  Reply with Quote
You are probably not setting the MeterAxis.setAxisTickSpace and MeterAxis.setAxisMinorTicksPerMajor properties correctly to reflect the range that you want. The following method that creates a meter with a range of 23 to 26, works fine.
Note the lines:

meteraxis.setAxisTickSpace(0.2);
meteraxis.setAxisMinorTicksPerMajor(5);

that place a minor tick mark every 0.2 units, and a major tick mark every (0.2 * 5) = 1.0 units.


		
private void InitializeMeterIndicator2()
{
	ChartView chartVu  = this;
	ChartAttribute attrib1 = new ChartAttribute (Color.black, 1,ChartConstants.LS_SOLID, Color.blue);

	double startarcangle = 220;
	double arcextent = 260;
	double startarcscale = 23.0;
	double endarcscale = 26.0;
	boolean arcdirection = false;
	double arcradius = 0.60;
	double centerx = 0.0, centery= -0.0;
	Font meterFont = font24;

	RTMeterCoordinates meterframe = new RTMeterCoordinates(startarcangle, arcextent,
	startarcscale, endarcscale, arcdirection, centerx, centery, arcradius);

	meterframe.setGraphBorderDiagonal(0.0, 0.0, 1.0, 1.0) ;
	Background background = new Background( meterframe, ChartObj.PLOT_BACKGROUND, Color.white);			
	chartVu.addChartObject(background);

	RTMeterNeedleIndicator meterneedle = new RTMeterNeedleIndicator(meterframe, meterProcessVar1);
	meterneedle.setChartObjAttributes(attrib1);
	meterneedle.setNeedleLength ( 0.6);


	chartVu.addChartObject(meterneedle);

	RTMeterAxis meteraxis = new RTMeterAxis(meterframe, meterneedle);
	meteraxis.setChartObjAttributes(attrib1);
		
	meteraxis.setAxisTickDir(ChartObj.AXIS_MIN);
	meteraxis.setLineWidth(3);
	meteraxis.setLineColor( Color.black);
	meteraxis.setAxisTickSpace(0.2);
	meteraxis.setAxisMinorTicksPerMajor(5);
	meteraxis.setAxisMajorTickLength(20);
	meterneedle.setMeterAxis(meteraxis);
	chartVu.addChartObject(meteraxis);

	RTMeterAxisLabels meteraxislabels = new RTMeterAxisLabels(meteraxis);
	meteraxislabels.setTextFont(meterFont);
	meteraxislabels.setAxisLabelsDir(meteraxis.getAxisTickDir());
	meteraxislabels.setOverlapLabelMode( ChartObj.OVERLAP_LABEL_DRAW);
	chartVu.addChartObject(meteraxislabels);
}
Go to Top of Page
  Previous Topic 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