Jump to content
JChartFX Community
  • 0

Using "bringtofront()" breaks LegendBox series order


ChrisS

Question

Hi,

 

I believe I have found a bug when using the function "bringtofront" (or "sendtoback") regarding how the series items are displayed in the LegendBox.

 

If you look at the two examples attached you will find that the first (jChartFX - Issue with broken legend A.html) correctly shows the series in the chart, in the tooltip and in the LegendBox.  The second example (jChartFX - Issue with broken legend B.html) adds the "bringToFront" code and puts the desired line chart on top of the bar chart.  The LegendBox now shows the incorrect color and marker style; the chart itself, and the tooltip keep the original colors and marker styles.

 

Can you please assist and confirm this is an issue, or if there is a workaround we could do so that the LegendBox displays the items correctly?

 

Thank you,

Chris

 

 

jChartFX - Issue with broken legend A.html

jChartFX - Issue with broken legend B.html

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

I noticed that after you are calling BringToFront you are setting the series labels (getSeries().getItem(X).setText("AA"), can you try setting the series labels before using BringToFront? I think this will generate the desired result.

 

Once you invoke BringToFront or SendToBack we reorder the series collection so anything done after that would have to use the "new" series indices.

 

JuanC

Link to comment
Share on other sites

  • 0

Hi Juan,

 

That is great.  It does work now that I moved the series label assignments before the "bringtofront."  The only other minor issue I noticed is that the legend series order is rotated (unlike the tooltip where the order remains the same).  But maybe that is intentional.

 

I would ask that the documentation be updated to reflect this need to use bringtofront after all series assignments are done.

Thank you so much for your help!

Chris

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