Open ybotquelen opened 3 years ago
Can you please show me what code doesn't compile any more?
Hello,
Please find below a sample class, the methods "setCustomToolTips" and "setToolTips" doesn't seem to exist anymore on the class BubbleSeries.
import java.awt.Font;
import java.text.DecimalFormat;
import org.knowm.xchart.BubbleChart;
import org.knowm.xchart.BubbleChartBuilder;
import org.knowm.xchart.BubbleSeries;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.style.BubbleStyler;
import org.knowm.xchart.style.Styler;
import org.knowm.xchart.style.Styler.LegendLayout;
public class CustomBubbleTooltip {
public static DecimalFormat decimalFormat = new DecimalFormat("#%");
public static void main(String[] args) {
BubbleChart chart = getBubbleChart();
new SwingWrapper(chart).displayChart();
}
public static BubbleChart getBubbleChart() {
double[] data = new double[]{1298.0, 0.0215, 279.0};
String tooltip = decimalFormat.format(data[1]) + " (" + ((int)data[2]) + "/" + ((int)data[0]) + ")";
BubbleChart chart = new BubbleChartBuilder().width(800)
.height(600).title("Some title").xAxisTitle("Volume").yAxisTitle("Rate")
.build();
setBubbleSyler(chart);
BubbleSeries bubbleSerie = chart.addSeries("serieName", new double[] { data[0] }, new double[] { data[1] }, new double[] { data[2] });
bubbleSerie.setCustomToolTips(true);
bubbleSerie.setToolTips(new String[] {tooltip});
return chart;
}
public static void setBubbleSyler(BubbleChart chart) {
BubbleStyler styler = chart.getStyler();
styler.setLegendPosition(Styler.LegendPosition.InsideSW);
//styler.setLegendPosition(Styler.CardinalPosition.InsideSW);
styler.setLegendLayout(LegendLayout.Horizontal);
styler.setYAxisDecimalPattern("%");
styler.setXAxisTickMarkSpacingHint(50);
styler.setAntiAlias(true);
styler.setToolTipsEnabled(true);
styler.setToolTipsAlwaysVisible(true);
styler.setHasAnnotations(true);
styler.setToolTipFont(new Font("SansSerif", Font.PLAIN, 14));
}
}
Thanks. The API is going to be changed in an upcoming release. I'll let you know here when it's ready. Sorry for removing that. Please just use 3.6.5 for now. (3.6.6 is buggy).
note to self: do this like the custom cursor formatting code.
Hello, 3 years later the custom tooltip feature for bubble charts is still missing: do you plan to re-implement this feature in a later release ? Thank you in advance!
On my bubble charts, I use custom tooltips, by my code doesn't compile anymore since the latest 3.7.0 release. Is that feature definitely removed or does it work differently now ?
Thank you for your answer,