Jump to content
JChartFX Community
  • 0

point label color per series - bug


ql_maxg

Question

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.

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

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
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0

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