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

Not able to implement onClick for line chart. #12

Closed
aadesh0118 opened this issue May 31, 2018 · 6 comments
Closed

Not able to implement onClick for line chart. #12

aadesh0118 opened this issue May 31, 2018 · 6 comments

Comments

@aadesh0118
Copy link

I am trying to set customise the tooltip and set some info on it. But for some reason it does not work.

cartesian.setOnClickListener(new ListenersInterface.OnClickListener(new String[]{"x", "value"}) {
        @Override
        public void onClick(Event event) {

            Log.e("Route", "Graphs Clicked "+ event.getData().get("x") + " "+ event.getData().get("value"));

            Toast.makeText(RouteMapperActivity.this, event.getData().get("x") + ":" + event.getData().get("value"), Toast.LENGTH_SHORT).show();
            cartesian.getTooltip().setTitle("Date : " );
            cartesian.getTooltip().setFormat("Speed : ");
            setToolTip();

        }
    });

the log is printing but nothing happens to the tooltip.

@Shestac92
Copy link

@aadesh0118
There's no need in listener at all in this case. All you need is to set formats. Replace your code with the following lines:

cartesian.getTooltip().setTitleFormat("Date : {%x}");
cartesian.getTooltip().setFormat("Speed : {%value}");

@aadesh0118
Copy link
Author

Okay got it. I have a question though if there is no listener then how can i take x and use it else where.

Basically on the title i am trying to print a value from a list at position {%x}

Something like this
cartesian.getTooltip().setTitleFormat("Date : {%x}" + time_list.get(Integer.parseInt("{%x}")));

@Shestac92
Copy link

@aadesh0118
In this case, it depends on what's the time_list. Is it a dataset for the chart or it's outside array/object/collection?

@fightaadeshfight
Copy link

fightaadeshfight commented Jun 1, 2018

its an outside list. The value of x will give the position at which the value is stored.

@Shestac92
Copy link

@aadesh0118 @fightaadeshfight
In this case, unfortunately, the listener unable to handle this feature. We are planning to implement this opportunity next several weeks.

@aadesh0118
Copy link
Author

oh.. okay. although i figured something. i made the list part of the chart (like giving a third parameter "category"). This sort of solves my problem. Thanks anyway.

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

3 participants