Skip to content
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

For bar graphs, center value label above bar #1

Open
newacct opened this issue Aug 24, 2010 · 3 comments
Open

For bar graphs, center value label above bar #1

newacct opened this issue Aug 24, 2010 · 3 comments

Comments

@newacct
Copy link

newacct commented Aug 24, 2010

For bar graphs, is it possible to display the value label centered above the bar? Currently, there are two options: if the bar's align option is "left" (the default), the value label appears on top of the bar to the left side; or, if the bar's align option is "center", the value label appears on top of the bar to the right of center. Neither is visually appealing.

@leonardoeloy
Copy link
Owner

Could you show your graph setup so I can work on that?

@newacct
Copy link
Author

newacct commented Aug 24, 2010

<html>
<head>
<script language="javascript" type="text/javascript" src="jquery.js"></script>
<script language="javascript" type="text/javascript" src="jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="jquery.flot.valuelabels.js"></script>
</head>
<body>

<div id="placeholder" style="width:800px;height:500px"></div>

<script id="source" language="javascript" type="text/javascript">
$(function () {
    $.plot($("#placeholder"),
           [ [ [ 0, 12345 ], [ 10, 67890 ] ] ],
           { bars: { show: true }, valueLabels: { show: true } }
    );
});
</script>

</body>
</html>

@fizgig10
Copy link

I changed the line "x_pos = xx;" to "x_pos = xx-5*(val.length-1);" Seemed to work ok then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants