Single tooltip for stacked barchart

Thread is closed for posting
3 posts, 0 answers
  1. Alex
    Alex avatar
    54 posts
    Member since:
    Feb 2009

    Posted 12 May 2015 Link to this post

    Is it possible to have a single tooltip that will display, at the top of the stack, aggregated data from all parts of the stacked bar, no matter what part the user touches.Also, how do I add the % sign to the Y LinearAxis of the chart. I guess setStringFormat on the LinearAxis object is the way to go, but cannot figure out the format syntax.
  2. Alex
    Alex avatar
    54 posts
    Member since:
    Feb 2009

    Posted 12 May 2015 in reply to Alex Link to this post

    Please delete the two extra duplicate posts. It was reporting a failure when I was trying to post, while it actually did post the message
  3. Victor
    Victor avatar
    1358 posts

    Posted 15 May 2015 Link to this post

    Hi Alexandar,

    Thanks for the questions.
    You can call setLabelFormat() with a java format string.
    To display aggregate data in the tooltip you have to provide a custom tooltip adapter. For example:
    public class CustomTooltipAdapter extends ChartTooltipContentAdapter {
        CategoricalAxis axis;
        public CustomTooltipAdapter(Context context, CategoricalAxis axis) {
            this.axis = axis;
        public View getView(Object[] targets) {
            Object category = ((CategoricalDataPoint)targets[0]).getCategory();
            List<DataPoint> points = axis.getDataPointsForValue(category);
            LinearLayout tooltipContainer = new LinearLayout(this.context);
            TextView categoryView = new TextView(this.context);
            categoryView.setText(String.format("Category: %s", category.toString()));
            for(DataPoint point : points) {
            return tooltipContainer;
        private View createViewForPoint(CategoricalDataPoint point) {
            BarSeries series = (BarSeries)point.getParent().getPresenter();
            TextView pointView = new TextView(this.context);
            pointView.setText(String.format("Value: %f.2", point.getValue()));
            return pointView;
    This assumes that you are using CategoricalAxis. If you are using DateTimeContinuousAxis you will have make a few modifications.

    Please write again if you need further assistance.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top