Jump to content
JChartFX Community
  • 0
Sign in to follow this  
ql_maxg

point label color per series - bug

Question

ql_maxg    0

Hello!

Just noticed another bug, when I have combined charts series and only  one series have label - then its not possible to change point label text color ( getPointLabels().setVisible(true) and then: getPointLabels().setTextColor(#..) does not work for only one single series)

It works only when all labels for all series are visible.

Please fix ASAP.

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0
JuanC    3

I am not sure what you mean by "when I have combined chart series"

 

I tried this

 

chart1.setGallery(cfx.Gallery.Bar);

chart1.setDataSource([{"A":10, "B":14}, {"A":11, "B":9}, {"A": 13, "B":12}]);
chart1.getSeries().getItem(1).getPointLabels().setVisible(true);
chart1.getSeries().getItem(1).getPointLabels().setTextColor("#FF0000");
 
And in case you meant combining galleries, also tried this
 
chart1.setGallery(cfx.Gallery.Bar);
chart1.setDataSource([{"A":10, "B":14}, {"A":11, "B":9}, {"A": 13, "B":12}]);
chart1.getSeries().getItem(0).setGallery(cfx.Gallery.Lines);
chart1.getSeries().getItem(1).getPointLabels().setVisible(true);
chart1.getSeries().getItem(1).getPointLabels().setTextColor("#FF0000");
 
Can you post a small sample that shows the problem you are experiencing?
 
Are you using CSS? If so please note that jChartFX can operate in one of 2 modes

 

1) Without including any of the jChartFX CSS files (typically one "attribute" and one "palette")

 

In this mode you can change any colors/fonts using our API, e.g. this will generate red point labels for the second series

 

chart1.setGallery(cfx.Gallery.Bar);
chart1.setDataSource([{"A":10, "B":14}, {"A":11, "B":9}, {"A": 13, "B":12}]);
chart1.getSeries().getItem(1).getPointLabels().setVisible(true);
chart1.getSeries().getItem(1).getPointLabels().setTextColor("#FF0000");
 
In a similar way you could change the color for the bars as follows
 
chart1.getSeries().getItem(1).setColor("#FFFF00");
 
2) Including our CSS files
 
In this mode, the SVG generated by jChartFX will not have colors but instead will use classes. In this mode you should configure colors/fonts/etc by modifying the appropriate colors.
 
I noticed that when we generate Point Labels when using CSS, we only generate the labels with a class "PointLabel", we will fix in future builds by also including the series, e.g. "PointLabel PointLabel1" to make it easier to change colors on a per-series basis.
 
Regards,
 
JuanC

Share this post


Link to post
Share on other sites
  • 0
JuanC    3

The bug is related to a behavior where galleries that paint their labels inside (e.g. pie, bar, etc.) can use a different color to make sure labels are more visible.

 

You can workaround the bug by using the following line

 

seriesItem.getPointLabels().setTextColorMethod(cfx.PointLabelColor.Outside);

 
We will be fixing this issue in our next build.
 
Regards,
 
JuanC

Share this post


Link to post
Share on other sites
  • 0
JuanC    3

BTW, note that if you wanted to change the color for the bar labels and setting the line alignment such that the labels are painted inside the bars, you would need to change the inside color.

 

seriesItem2.getPointLabels().setVisible(true);
seriesItem2.getPointLabels().setLineAlignment(0);
seriesItem2.getPointLabels().setTextInsideColor("#FFFF00");

 

 
JuanC

Share this post


Link to post
Share on other sites
  • 0
JuanC    3

We are uploading a "pre-release" build that includes this fix, it should be ready to download later today, please let us know if you experience any issues.

 

Regards,

 

JuanC

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×