Jump to content
Software FX Community

How Do I Change The Colour Of A Box In A Legend Box?


User (Legacy)
 Share

Recommended Posts

Hello!

I have used code to colour my chart and now wish to create a legend box for

it. I have used the code below to get 4 legends to appear in the box

cfxChart1.clearlegend(chart_legend)

cfxChart1.Legend(0)="Mon-Fri Units"

cfxChart1.Legend(1)="All other units"

cfxChart1.Legend(2)="Evening units"

cfxChart1.Legend(3)="Night units"

This code works ok, the snag is that all of the colour boxes in the legend

box appear as the same colour. How can I get them to appear as the 4

seperate colours I require? The only correctly coloured box is the first

one. A rapid reponse would be greatly appreciated

Cheers

Paul

Link to comment
Share on other sites

The following code (in Delphi) works with the ChartFX 98 component but fails

with the ChartFX IE version that I am using

ChartFX1.clearlegend(chart_legend);

ChartFX1.Legend[nPROFCOLOR] := 'All Other Units (kW)';

ChartFX1.Legend[nWeekendPROFCOLOR] := 'Weekend Units (kW)';

ChartFX1.Legend[nMonToFriPeakProfcolor] := 'Mon-Fri Units (kW)';

ChartFX1.Legend[nEveProfcolor] := 'Evening Units (kW)' ;

ChartFX1.Legend[nNightProfcolor] := 'Night Units (kW)';

ChartFX1.Legend[nEstProfcolor] := 'Estimated Units (kW)';

ChartFX1.LegendBoxObj.SkipEmpty := True;

ChartFX1.LegendBoxObj.docked:=258{TGFP_BOTTOM};

ChartFX1.LegendBox := True;

ChartFX1.serLegBox := false;

Where nProfColor, etc are all Delphi colour constants such as clRed, clBlue,

etc

Cheers

Paul

"Paul Saxton" <paul.saxton@stcenergy.com> wrote in message

news:PEpDJT3nBHA.1272@webserver1.softwarefx.com...

> Hello!

>

> I have used code to colour my chart and now wish to create a legend box

for

> it. I have used the code below to get 4 legends to appear in the box

>

> cfxChart1.clearlegend(chart_legend)

> cfxChart1.Legend(0)="Mon-Fri Units"

> cfxChart1.Legend(1)="All other units"

> cfxChart1.Legend(2)="Evening units"

> cfxChart1.Legend(3)="Night units"

>

> This code works ok, the snag is that all of the colour boxes in the legend

> box appear as the same colour. How can I get them to appear as the 4

> seperate colours I require? The only correctly coloured box is the first

> one. A rapid reponse would be greatly appreciated

>

> Cheers

>

> Paul

>

>

baddecimalgraph.bmp

Link to comment
Share on other sites

Neither of these approaches work.  Any other ideas?  My revised code is

below

cfxChart1.MultipleColors=True

cfxChart1.SerLeg(0)="Mon-Fri Units"

cfxChart1.SerLeg(1)="All other units"

cfxChart1.SerLeg(2)="Evening units"

cfxChart1.SerLeg(3)="Night units"

cfxChart1.LegendBoxObj.SkipEmpty=True

cfxChart1.serLegBox = True

cfxChart1.LegendBox = False

Cheers

Paul

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

news:CS8Lk53nBHA.1172@webserver1.softwarefx.com...

> You need to set MultipleColors = True or use the Series Legend instead of

> the Values legend.

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

You must be doing something else, maybe allocating the array of colors

somewhere else in your code. The piece of code that you sent me works fine

in a default chart, you can try starting from the scratch.

So the problem that you are having is not with this code. Check the rest of

your code, specifically check the calls to OpenDataEx.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...