Git Product home page Git Product logo

Comments (11)

diogobernardino avatar diogobernardino commented on July 16, 2024

Thanks for raising the issue, it might help other people.
As I told you before, in the meantime I've added the method ArrayList<Region> getEntriesRegions(int setIndex) (only in DEV branch for the time being) for those cases when you want to place tooltips without necessarily need to get a click event.
From that method you will get all regions matching each entry of a given set and then you're free to build your tooltip the way you want (as I do in the sample application for example).
I hope this answers your question. If not let me know.

from williamchart.

Shanmugapriyan22 avatar Shanmugapriyan22 commented on July 16, 2024

Thanks for the reply, Will check and let you know.

from williamchart.

Shanmugapriyan22 avatar Shanmugapriyan22 commented on July 16, 2024

Hi, Still i am confusing how to use that in bar chart ?
In updateBarChart() method how to use ArrayList getEntriesRegions(int setIndex) and show the values in bar.Can you please create sample for that ? It will helpful for me.Thanks.

from williamchart.

diogobernardino avatar diogobernardino commented on July 16, 2024

Have you looked, for example, at the method showBarTooltip in the sample application?
If I understood you correctly you will need something like:

updateBarChart(){
    ...
    chart.show();
    regions = chart.getEntriesRegions(setIndex);
    for(int i = 0; i < regions.size(); i++)
        showTooltip(regions.get(i))
}

private void showTooltip(Rect rect){
    // With the help of ``LayoutParams``you can set the position and size of your tooltip.
    LayoutParams layoutParams = new LayoutParams(rect.width(), rect.height());  
    layoutParams.leftMargin = rect.left;
    layoutParams.topMargin = rect.top;

    // The ``R.layout.tooltip``can take any shape you want (once again, you can see the 
    // tooltip xml examples in the sample application). 
    mBarTooltip = (TextView) getLayoutInflater().inflate(R.layout.tooltip, null);

    // Set the previous configured ``LayoutParams``to the inflated layout.
    mBarTooltip.setLayoutParams(layoutParams);

    // Pass the view to the chart
    chart.showTooltip(mBarTooltip);
}

from williamchart.

Shanmugapriyan22 avatar Shanmugapriyan22 commented on July 16, 2024

Hi here is the code based on your suggestion.

ArrayList<ArrayList> regions;
regions = mBarChart.getEntriesRegions(setIndex);
for (int i = 0; i < regions.size(); i++)
showTooltip(regions.get(i));

What's the value for set Index ?

You created private void showTooltip(Rect rect){......} but in the for loop you created showTooltip(regions.get(i)).

from williamchart.

diogobernardino avatar diogobernardino commented on July 16, 2024

The meaning of setIndex should be also either described in the code or in the Wiki documentation, you should take a look. The setIndex is the index value of your dataset. As an example, in case you only have a dataset in your chart your setIndex will be 0.

Didn't get your last question.

from williamchart.

Shanmugapriyan22 avatar Shanmugapriyan22 commented on July 16, 2024

You created the following method to display tooltip.
private void showTooltip(Rect rect){...}

But inside the for loop you created the following method
showTooltip(region.get(i))

If i put setIndex value 0. I am getting error.

from williamchart.

diogobernardino avatar diogobernardino commented on July 16, 2024

Inside the loop I haven't created any method, I simply called the method showTooltip(Region).
If you get an error than you're doing something wrong. Remember that you can only call the method getEntriesRegions after you instantiate your chart and show it. Feel free to post your error here.

from williamchart.

Shanmugapriyan22 avatar Shanmugapriyan22 commented on July 16, 2024

Hi, there is no method for getEntriesRegions(set Index) in the chart view class.
Inside the loop you have called showTooltip(Region).You didn't create any method showTooltip(Region).

Where should i call the following method ?

private void showTooltip(Rect rect){
// With the help of LayoutParamsyou can set the position and size of your tooltip.
LayoutParams layoutParams = new LayoutParams(rect.width(), rect.height());
layoutParams.leftMargin = rect.left;
layoutParams.topMargin = rect.top;
// The R.layout.tooltipcan take any shape you want (once again, you can see the
// tooltip xml examples in the sample application).
mBarTooltip = (TextView) getLayoutInflater().inflate(R.layout.tooltip, null);
// Set the previous configured LayoutParamsto the inflated layout.
mBarTooltip.setLayoutParams(layoutParams);
// Pass the view to the chart
chart.showTooltip(mBarTooltip);
}

I am struggling for past 3 days.Please help me Very Thanks..

from williamchart.

diogobernardino avatar diogobernardino commented on July 16, 2024

Yes there is, I already told you twice that for the time being is only in DEV branch.

What I gave was a draft of code from the top of my head which you should understand, not just simply make a copy/paste. You're are struggling for 3 days and you couldn't figure it out that each Region object has a getBounds() method to return its Rect object? I'm really trying to help you, but you need to understand what you are doing before you actually do it.

from williamchart.

Shanmugapriyan22 avatar Shanmugapriyan22 commented on July 16, 2024

HI @diogobernardino I am still not implement your chart.Can you please guide me ?

from williamchart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.