-
Notifications
You must be signed in to change notification settings - Fork 74
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
Allow label function to return svg elements to be rendered as labels e.g. svg:text #9
Comments
Hi @pzontrop, The label function currently can only return plain text and not elements. The future version may have this functionality. Meanwhile you can label display via CSS and show whatever HTML in a div and place that div in the center of the gauge (e.g. via CSS transforms) and update the div in the label function |
@naikus I have similar need - I want to have 2 lines in label.
so now I can declare gaube like this:
Not perfect but works just fine :) Is there a chance this could be added? |
@Misiu This is good! Although I'd like the the label function determine what to do with the value. If it returns a string, it is set as textContent. If it does not return a value, the gauge can assume that label handled (appended) content to the value element. var val = label.call(opts, theValue, gaugeValueElem);
if(typeof val === "string") {
gaugeValueElem.textContent = val;
}
// otherwise the gauge assumes the label took care of showing the value inside valueElement This will be backwards compatible too since the first argument to the label function will always be value of the gauge. What are you thoughts? |
@naikus thanks for reply. Ideally all labels should be initialized when calling |
@Misiu Currently there is a workaround for your case (easier if your second label is static). This is without any change in the gauge's code. See the online demo for an example of this. Meanwhile, I'll be working to implement this feature. |
Hi @naikus, has this been implemented yet? |
What kind of elements do you want inside the guage? Graphic or only text or both? |
@naikus, since the element that i need inside of the gauge is quite complex i decided to create directly a |
I'm not looking to render icons in the center, but I do find the inline styles on the
I can change the color with |
I would like to create a gauge with an icon in the middle and the value below it. For the icon i have created a webfont and it does seem to render. However my tspans that i would like to use to have 2 lines are not rendered. I can actually see the full string (<tspan....)
Is there any other way to have 2 lines in the middle of the gauge? Or am i missing something else?
The text was updated successfully, but these errors were encountered: