Jump to content
JChartFX Community
  • 0

How do you change the default fill color of a rectangle-shaped custom legend item?


papa.stiff

Question

I am adding a custom legend item with a rectangle marker in my legend box. I was trying to use this code to do that:


...

var legBoxItem = new cfx.CustomLegendItem();

legBoxItem.setMarkerShape(cfx.MarkerShape.Rect);

legBoxItem.getAttributes().setColor("#000000");

legBox.getCustomItems().add(legBoxItem);

...

but the color that changed is the outline of the marker not the fill color which is still white.  I have also tried setting a tag name to the item and add a "fill:" in the chart css but that did not work either. I am currently settling with the marble marker shape because that is the only shape that auto-fills its interior with the set color, albeit in gradient.

Any clues/tips are appreciated.

 

Cheers,

 

papa.stiff

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

This is a bug, we are in the process of testing a fix for it.

In the meantime you can workaround the bug by changing the MarkerStyle for all series to Filled, to retain the look of your markers you can then set the MarkerStyle for each series to Hollow, e.g. if your chart has 2 series

chart1.getAllSeries().setMarkerStyle(cfx.MarkerStyle.Filled);

chart1.getSeries().getItem(0).setMarkerStyle(cfx.MarkerStyle.Hollow);

chart1.getSeries().getItem(1).setMarkerStyle(cfx.MarkerStyle.Hollow);

 

JuanC 

 

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
Answer this question...

×   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.

Loading...
×
×
  • Create New...