Jump to content
Software FX Community

legend box - Assiging Point Lable to the legend box and to display below the chart


User (Legacy)

Recommended Posts

Hi,

Basically i am trying to create a PIE chart with a legend box. We have a

specific requirement that the legend box should be displayed at the bottom

of the chart and it should contain all the point lables. How can i

accomplish this requirement?

I tried to display the legend box using the following line of code..

chart1.getLegendBoxObj().setDocked(1);

As soon as i include this line, the entire legend box disappears.

Do we have any forum for the chartfx for java? Can you please point any

additional documentation or forum that may be helpful for us?

Here is the snippet, we used for the chart creation :

ChartServer chart1 = new ChartServer( application, request, response );

// Set the chart data

chart1.openData( COD.VALUES, 1, 5 );

chart1.setValue( 0, 0, 41 );

chart1.setValue( 0, 1, 44 );

chart1.setValue( 0, 2, 34 );

chart1.setValue( 0, 3, 24 );

chart1.setValue( 0, 4, 17 );

chart1.closeData( COD.VALUES );

// Formatting the chart

chart1.setGallery( Gallery.PIE );

chart1.setLegend( 0, "Mid-cap Equities" );

chart1.setLegend( 1, "Large-cap Equities" );

chart1.setLegend( 2, "International Equities" );

chart1.setLegend( 3, "Fixed Income" );

chart1.setLegend( 4, "Cash" );

chart1.setLegendBox( true );

chart1.setUserLegendBox( true );

chart1.getLegendBoxObj().setToolBorder(0);

chart1.getLegendBoxObj().setAlignment(1);

chart1.getLegendBoxObj().setDrawingArea(true);

//chart1.getLegendBoxObj().setDocked(1);

//LegendBox.setDocked(3);

chart1.setUserLegendBox( true );

chart1.setPointLabels( false);

// The following line sets the HTTP content type header and streams

// the chart directly to the ServletOutputStream.

chart1.getHtmlData( width, height, "PNG" );

Thanks,

Sivakumar

Link to comment
Share on other sites

Try chart1.getLegendBoxObj().setDocked(Docked.BOTTOM);

It seems like setDocked is not understanding the "numbers" (1,2,etc), but it

does work when you use the constants. We'll fix this in the next service

pack.

For information and documentation you can go

http://support.softwarefx.com/cfxie for support, updates, bugs and fixes and

online documentation, this newsgroup for discussion, or contacting Technical

support; we offer free phone and email support to trial users and Customers

with Support Account (Chart FX for Java includes 1 year of support).

GA

SoftwareFX

"Sivakumar Mallaiyasam" <sivasrees@verizon.net> wrote in message

news:1mbG3xG4DHA.2468@webserver3.softwarefx.com...

> Hi,

>

> Basically i am trying to create a PIE chart with a legend box. We have

a

> specific requirement that the legend box should be displayed at the bottom

> of the chart and it should contain all the point lables. How can i

> accomplish this requirement?

>

> I tried to display the legend box using the following line of code..

> chart1.getLegendBoxObj().setDocked(1);

>

> As soon as i include this line, the entire legend box disappears.

>

> Do we have any forum for the chartfx for java? Can you please point any

> additional documentation or forum that may be helpful for us?

>

>

>

> Here is the snippet, we used for the chart creation :

> ChartServer chart1 = new ChartServer( application, request, response );

>

> // Set the chart data

>

> chart1.openData( COD.VALUES, 1, 5 );

>

> chart1.setValue( 0, 0, 41 );

>

> chart1.setValue( 0, 1, 44 );

>

> chart1.setValue( 0, 2, 34 );

>

> chart1.setValue( 0, 3, 24 );

>

> chart1.setValue( 0, 4, 17 );

>

> chart1.closeData( COD.VALUES );

>

> // Formatting the chart

>

> chart1.setGallery( Gallery.PIE );

>

> chart1.setLegend( 0, "Mid-cap Equities" );

>

> chart1.setLegend( 1, "Large-cap Equities" );

>

> chart1.setLegend( 2, "International Equities" );

>

> chart1.setLegend( 3, "Fixed Income" );

>

> chart1.setLegend( 4, "Cash" );

>

> chart1.setLegendBox( true );

>

> chart1.setUserLegendBox( true );

>

> chart1.getLegendBoxObj().setToolBorder(0);

>

> chart1.getLegendBoxObj().setAlignment(1);

>

> chart1.getLegendBoxObj().setDrawingArea(true);

>

> //chart1.getLegendBoxObj().setDocked(1);

>

>

>

>

>

> //LegendBox.setDocked(3);

>

> chart1.setUserLegendBox( true );

>

> chart1.setPointLabels( false);

>

> // The following line sets the HTTP content type header and streams

>

> // the chart directly to the ServletOutputStream.

>

> chart1.getHtmlData( width, height, "PNG" );

>

>

>

>

>

> Thanks,

>

> Sivakumar

>

>

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for your valuable input.

Currently the point lables are displayed inside the pie chart. Is there

anyway that i can display the PointLables in the legend box instead of the

chart?

To Display the UserLegendBox:

chart1.setUserLegendBox( true );

I have set the userLegendBox property to true. But still i am not seeing

the userLegendBox in my chart in addition to the legend box.

Document claims that if we set the above property true, the userLegendBox

will be displayed. But it is not. Do i have to set all the elements to see

the UserLegendBox?

Thanks,

Sivakumar

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:26dx8RP4DHA.2468@webserver3.softwarefx.com...

> Try chart1.getLegendBoxObj().setDocked(Docked.BOTTOM);

>

> It seems like setDocked is not understanding the "numbers" (1,2,etc), but

it

> does work when you use the constants. We'll fix this in the next service

> pack.

>

> For information and documentation you can go

> http://support.softwarefx.com/cfxie for support, updates, bugs and fixes

and

> online documentation, this newsgroup for discussion, or contacting

Technical

> support; we offer free phone and email support to trial users and

Customers

> with Support Account (Chart FX for Java includes 1 year of support).

>

> GA

> SoftwareFX

>

>

> "Sivakumar Mallaiyasam" <sivasrees@verizon.net> wrote in message

> news:1mbG3xG4DHA.2468@webserver3.softwarefx.com...

> > Hi,

> >

> > Basically i am trying to create a PIE chart with a legend box. We

have

> a

> > specific requirement that the legend box should be displayed at the

bottom

> > of the chart and it should contain all the point lables. How can i

> > accomplish this requirement?

> >

> > I tried to display the legend box using the following line of code..

> > chart1.getLegendBoxObj().setDocked(1);

> >

> > As soon as i include this line, the entire legend box disappears.

> >

> > Do we have any forum for the chartfx for java? Can you please point any

> > additional documentation or forum that may be helpful for us?

> >

> >

> >

> > Here is the snippet, we used for the chart creation :

> > ChartServer chart1 = new ChartServer( application, request, response );

> >

> > // Set the chart data

> >

> > chart1.openData( COD.VALUES, 1, 5 );

> >

> > chart1.setValue( 0, 0, 41 );

> >

> > chart1.setValue( 0, 1, 44 );

> >

> > chart1.setValue( 0, 2, 34 );

> >

> > chart1.setValue( 0, 3, 24 );

> >

> > chart1.setValue( 0, 4, 17 );

> >

> > chart1.closeData( COD.VALUES );

> >

> > // Formatting the chart

> >

> > chart1.setGallery( Gallery.PIE );

> >

> > chart1.setLegend( 0, "Mid-cap Equities" );

> >

> > chart1.setLegend( 1, "Large-cap Equities" );

> >

> > chart1.setLegend( 2, "International Equities" );

> >

> > chart1.setLegend( 3, "Fixed Income" );

> >

> > chart1.setLegend( 4, "Cash" );

> >

> > chart1.setLegendBox( true );

> >

> > chart1.setUserLegendBox( true );

> >

> > chart1.getLegendBoxObj().setToolBorder(0);

> >

> > chart1.getLegendBoxObj().setAlignment(1);

> >

> > chart1.getLegendBoxObj().setDrawingArea(true);

> >

> > //chart1.getLegendBoxObj().setDocked(1);

> >

> >

> >

> >

> >

> > //LegendBox.setDocked(3);

> >

> > chart1.setUserLegendBox( true );

> >

> > chart1.setPointLabels( false);

> >

> > // The following line sets the HTTP content type header and streams

> >

> > // the chart directly to the ServletOutputStream.

> >

> > chart1.getHtmlData( width, height, "PNG" );

> >

> >

> >

> >

> >

> > Thanks,

> >

> > Sivakumar

> >

> >

>

>

Link to comment
Share on other sites

The User Legend Box, is a legend box that contains information set by you

(the user). If you haven't set any items to it, the legend box will be empty

and therefore will not display.

Which labels do you want to display in the legend box ? the labels that you

are assigning through chart.setLegend() ?

The first approach:

chart1.getLegendBoxObj().setDocked(Docked.BOTTOM);

Is correct and will display the legends assigned using the setLegend method

(or coming from the database).

If I am not understanding correctly, please attach a screenshot of what you

see before and after moving the legend box.

--

FP

Software FX

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...