ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Java - ChartDirector - AngularMeter - Automatic Ticks without labels
Posted by Kapil on Dec-08-2014 21:43
Attachments:
Is it possible to create meter like the one attached (MeterChart.png - 1st attachment)?

1. As you can see in the attachment, the ticks are present without any labels.
    Labels are present only at zone boundaries.

2. MeterChart.png chart was prepared using JFreeChart and it automatically spreads out
the ticks. Is it possible to do this with ChartDirector? Can the tick units be determined by
ChartDirector automatically?

3. I managed to get meter graph using ChartDirector and it looks good (2nd attachment).
But, if I add major
ticks, it also adds corresponding labels which I do not want. I want labels only at the end
of each zone.
I used following code to set labels manually.

                meter.addLabel(redMin,redMin+"");
meter.addLabel(redMax,redMax+"");
meter.addLabel(yellowMin,yellowMin+"");
meter.addLabel(yellowMax,yellowMax+"");
meter.addLabel(greenMin,greenMin+"");
meter.addLabel(greenMax,greenMax+"");

Is it possible to add just the ticks and not labels (without adding every tick in loop for
which I would also need to determine each tick value).

Thanks
MeterChart.png
ChartDirectorMeter.png

  Re: Java - ChartDirector - AngularMeter - Automatic Ticks without labels
Posted by Peter Kwan on Dec-09-2014 04:37
Hi Kapil,

May be you can try something like:

// Scale from 0 to 400, with a major tick every 400 units, and a minor tick every 20 units
m.setScale(0, 400, 400, 20);
// Set the label format to a space, so no label is visible
m.setLabelFormat(" ");

//Add the visible labels
m.addLabel(1, "1");
m.addLabel(200, "200");
m.addLabel(300, "300");
m.addLabel(400, "400");

If you want the labels to have different colors, you can use CDML, like:

m.addLabel(200, "<*color=FF0000*>200");

For the style of the ticks, you can use BaseMeter.setTickLength, BaseMeter.setLineWidth
and BaseMeter.setMeterColors to control the tick length, width and color.

Hope this can help.

Regards
Peter Kwan

  Re: Java - ChartDirector - AngularMeter - Automatic Ticks without labels
Posted by Kapil on Dec-09-2014 15:08
Thanks Peter !