I checked out the tooltip formatter but I didn't find the standard format which would look like this (image)
I only need to add a span style=color (red and green for negative and positive values)
-Michael
Code: Select all
HIChartView chartView = findViewById(R.id.chartview1);
HIOptions options = new HIOptions();
HIXAxis xAxis = new HIXAxis();
String[] categoriesList = new String[] {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
xAxis.setCategories(new ArrayList<>(Arrays.asList(categoriesList)));
options.setXAxis(new ArrayList<HIXAxis>(){{add(xAxis);}});
HISpline series1 = new HISpline();
series1.setName("Tokyo");
series1.setColor(HIColor.initWithName("green"));
series1.setData(new ArrayList<>(Arrays.asList(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6)));
options.setSeries(new ArrayList<>(Arrays.asList(series1)));
HITooltip tooltip = new HITooltip();
tooltip.setEnabled(true);
tooltip.setFormatter(new HIFunction("function() { return `<span style=\"color:${this.color}\">●</span> ${this.series.name}<br> x: <b>${this.point.category}</b><br>y: <b>${this.y}`; }"));
options.setTooltip(tooltip);
chartView.setOptions(options);
hubert.k wrote: ↑Wed Jun 29, 2022 1:13 pm pradeepkumarreddy,
Here is the same demo in Android:Kind regards!Code: Select all
HIChartView chartView = findViewById(R.id.chartview1); HIOptions options = new HIOptions(); HIXAxis xAxis = new HIXAxis(); String[] categoriesList = new String[] {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; xAxis.setCategories(new ArrayList<>(Arrays.asList(categoriesList))); options.setXAxis(new ArrayList<HIXAxis>(){{add(xAxis);}}); HISpline series1 = new HISpline(); series1.setName("Tokyo"); series1.setColor(HIColor.initWithName("green")); series1.setData(new ArrayList<>(Arrays.asList(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6))); options.setSeries(new ArrayList<>(Arrays.asList(series1))); HITooltip tooltip = new HITooltip(); tooltip.setEnabled(true); tooltip.setFormatter(new HIFunction("function() { return `<span style=\"color:${this.color}\">●</span> ${this.series.name}<br> x: <b>${this.point.category}</b><br>y: <b>${this.y}`; }")); options.setTooltip(tooltip); chartView.setOptions(options);