Comments (11)
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.
Thanks for the reply, Will check and let you know.
from williamchart.
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.
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.
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.
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.
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.
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.
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 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);
}
I am struggling for past 3 days.Please help me Very Thanks..
from williamchart.
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.
HI @diogobernardino I am still not implement your chart.Can you please guide me ?
from williamchart.
Related Issues (20)
- Set chart_smoothLine to true leads chart to draw weird negative hooks
- Set decimals of Y-Axis values HOT 1
- Setting custom point drawable only for specific points HOT 2
- Provide a way to let tooltips draw values HOT 1
- Stack bar charts HOT 1
- It is posible to add a stroke with a specific color on touch/click event? HOT 1
- Animation not working using proGuard HOT 1
- Move repository Jcenter to mavenCentral() HOT 2
- Crashlytics Error: BarChartView.kt line 78 com.db.williamchart.view.BarChartView.drawBars
- How to set up Y axis right? HOT 1
- Grid not fitting the points (squeezed)
- Is it possible to add a small button to show value on line touched?
- crash on tooltip onDataPointTouch HOT 1
- BarChart crashing when changing data on runtime HOT 1
- Function to clear the chart
- No documentation found!!! HOT 2
- Don't have Zoom in feature
- Failed to resolve: williamchart:williamchart:unspecified HOT 3
- Colors provided do not match the number of datapoints HOT 1
- Center Aligned Graph Draw
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from williamchart.