Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom data labels for Line Plot #227

Closed
spidru opened this issue Oct 23, 2017 · 2 comments
Closed

Custom data labels for Line Plot #227

spidru opened this issue Oct 23, 2017 · 2 comments

Comments

@spidru
Copy link

spidru commented Oct 23, 2017

I'm aware that recently, data labels have been added to XChart. However, I believe it is still not possible to label markers with custom strings. What I have in mind is something as shown below:

double[] xData = new double[10];
double[] yData = new double[10];
String[] labels = new String[10];
XYChart chart = new XYChartBuilder().build();
...
XYSeries series = chart.addSeries("demo", xData, yData, labels)
heavySea added a commit to heavySea/XChart that referenced this issue Nov 2, 2017
Proposed in knowm#227, I added an extra String for Series. By default it is the same as "name" but can be changed with the method "setLabel".
Also I changed the return types of the Setter to Series so you can concatenate those (like it is in inheriting classes). So you can do it now like this: chart.addSeries(...).setLabel(...).setShowInLegend(true);...
@hakantkn
Copy link
Contributor

hakantkn commented Jul 3, 2018

This is added at the latest commit.
To set custom tooltips use series.setToolTips().

@sergey124
Copy link

sergey124 commented Nov 4, 2018

This is added at the latest commit.
To set custom tooltips use series.setToolTips().

Thanks @hakantkn !

To make tooltips always visible use

chart.getStyler().setToolTipsEnabled(true);
chart.getStyler().setToolTipsAlwaysVisible(true);

To disable tooltips for single series, I use setToolTips() passing an array of null Strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants