Comments (5)
Hello, I've just added a new example that makes more sophisticated use of roles (and also edited the Readme to better explain roles).
Basically, how you should apply roles like the following:
roles: [
{type: 'number', role: 'interval'},
{type: 'number', role: 'interval'},
{type: 'string', role: 'annotation'},
{type: 'string', role: 'annotationText'},
{type: 'boolean', role: 'certainty'}
]
Don't change columnNames just because you're passing roles. They've nothing in common:
columnNames: ['Element', 'Density']
And for completeness, here's the data object:
data: [
['April', 1000, 900, 1100, 'A', 'Stolen data', true],
['May', 1170, 1000, 1200, 'B', 'Coffee spill', true],
['June', 660, 550, 800, 'C', 'Wumpus attack', true],
['July', 1030, null, null, null, null, false]
]
If this isn't correct or doesn't work for you, I'm happy to investigate further. I'd love to hear whether this has helped!
from angular-google-charts.
So, I finally got around to trying this out and I'm not quite getting the behavior I need. My data looks like:
data: [
[ "Cash", 31912.89737871802, 38666.46103793153, "$31,912.90", "$38,666.46"],
["Bonds", 89362.187203375, 85066.1985940699, "$89,362.19", "$85,066.20"],
["Stocks", 263889.47676791146, 262931.901718003, "$263,889.48", "$262,931.90"]
]
and my roles look like this:
roles: [
{"type": "string", "role": "annotation"},
{"type": "string", "role": "annotation"}
]
and I'm getting the annotations both showing up on the second bars only like this:
The annotations should be on the corresponding bar. What am I doing wrong? The documentation from google makes me think that the columns and roles shouldn't be separate and then combined. it should just be one array that we can pass in with column names and roles in the order we specify. Sorry if I am not understanding this right.
from angular-google-charts.
Hey, the changes you made to the roles did fix the annotation issue, however I have run into another problem because of the way you fixed it. I'm not sure if it is something I need to fix in my code or something you could do. The problem, is that when I have the roles for the annotation and my chart gets rerendered (like an ngIf, but in my case it's because I have the chart in a carousel component I created where only the current slide is rendered), it splices the roles into the columnNames. This works fine the first time the chart is rendered, but when it is removed (in my case, when the slide changes), and then rerendered (when you go back to the same slide), the roles are spliced in again, which makes it mismatched with the data. Too many columns. An error is thrown and the chart doesn't render at all. I'm sure I could fix it by regenerating the whole object to pass in, but that seems unnecessarily intensive. Is there a way you could add a check before you splice the roles in to see if they are already there?
from angular-google-charts.
You're right, I've just fixed it. Will release it tomorrow or in the upcoming days!
Thanks for noticing btw, I didn't think of how hardcore javascript is using copy-by-reference when writing this!
from angular-google-charts.
Awesome! I really appreciate your responsiveness. This package and your attentiveness to it are saving me so much time :)
from angular-google-charts.
Related Issues (20)
- Push latest version to npmjs.com HOT 2
- how to clear table in the latest api? HOT 1
- New version 2.2.3 is not compatible with the current stable version of Angular (v13.2.0) HOT 8
- Angular v8. Compilation fails when importing the module. Error states: 'Please add a @NgModule annotation'
- Unable to install angular-google-charts in project
- Angular google chart Version 2.2.2 Is not working on my existing Angular 9 Application HOT 1
- Use Types interfaces in project
- GoogleChartPackagesHelper.getPackageForChartName for angular 14
- The target entry-point "angular-google-charts" has missing dependencies: - @angular/core
- Update peerDependencies for Angular 15 HOT 4
- Locale Support HOT 1
- Expand Row interface definition HOT 1
- I don't get any error but I don't see anything
- Calendar Heatmap Type Not Work dynamicResize
- Angular 16 support HOT 8
- Customize tooltip
- broaden type Row in chart-base.component.ts HOT 1
- Memory leak
- This library is unmaintained HOT 2
- Angular 18 support
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 angular-google-charts.