-
Notifications
You must be signed in to change notification settings - Fork 400
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
label on each value? #9
Comments
There isn't and I think it would be difficult to implement I'm afraid. I think it would be trivial if only it were SVG and not canvas... |
i figured this much. For what its worth, jquery.sparkline which is also It might we worth checking out to see how they added this to their graphs. jquery.sparkline is a 129kb file but the 124kb difference can't entirely due to rendering that data. |
Thanks, I'll take a look. I've actually been thinking about this recently but had mostly decided it'd be more kb than it's worth, I may re-evaluate though. I was also thinking about making an SVG version - though that was before I added "retina" support. |
Just wanted to update everyone on how I solved this problem which is just to add the x- and y-axis labels in regular HTML and position them with CSS. Here's the actual code I used which is kinda verbose for the purpose of this discussion but the Peity chart has
|
I was able to add it very simply at least for pie charts. You can adapt this snippet easily enough. Cheers. $chart = $('span#by-week + svg.peity')
barWidth = chartWidth / data.length
for value, i in data
attr =
x: i*barWidth + barWidth/2
y: chartHeight-15
width: barWidth
height: 20
fill: if i >= data.length - @weeksRemaining then 'rgba(255,255,255,0.2)' else '#ffffff'
style: 'text-anchor:middle; font-size: 12px'
$text = $(document.createElementNS 'http://www.w3.org/2000/svg', 'text').attr(attr).html(value)
$chart.append $text |
Thanks for bumping this! Now that it's SVG I think this would just be a case of adding an attribute (probably |
that would be really nice. |
is there a way to see what the value is for each bar in a bar chart?
thanks,
tim
The text was updated successfully, but these errors were encountered: