Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-dashboard
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-analytics-dashboard
Commits
424ad4f6
Commit
424ad4f6
authored
Mar 05, 2015
by
Dennis Jen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stacked bars will hide labels if fewer than 3 characters can be displayed.
parent
7a71f0ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
analytics_dashboard/static/js/views/bar-view.js
+6
-3
analytics_dashboard/static/js/views/stacked-bar-view.js
+2
-1
No files found.
analytics_dashboard/static/js/views/bar-view.js
View file @
424ad4f6
...
@@ -44,11 +44,14 @@ define(['d3', 'nvd3', 'underscore', 'utils/utils', 'views/chart-view'],
...
@@ -44,11 +44,14 @@ define(['d3', 'nvd3', 'underscore', 'utils/utils', 'views/chart-view'],
var
barWidth
=
d3
.
select
(
self
.
options
.
barSelector
).
attr
(
'width'
),
// jshint ignore:line
var
barWidth
=
d3
.
select
(
self
.
options
.
barSelector
).
attr
(
'width'
),
// jshint ignore:line
// this is a rough estimate of how wide a character is
// this is a rough estimate of how wide a character is
char
tWidth
=
5
,
char
Width
=
6
,
characterLimit
=
Math
.
floor
(
barWidth
/
char
t
Width
),
characterLimit
=
Math
.
floor
(
barWidth
/
charWidth
),
formattedLabel
=
d
;
formattedLabel
=
d
;
if
(
_
(
formattedLabel
).
size
()
>
characterLimit
)
{
if
(
characterLimit
<
3
)
{
// no labels will be displayed if label space is limited
formattedLabel
=
''
;
}
else
if
(
_
(
formattedLabel
).
size
()
>
characterLimit
)
{
formattedLabel
=
Utils
.
truncateText
(
d
,
characterLimit
);
formattedLabel
=
Utils
.
truncateText
(
d
,
characterLimit
);
}
}
...
...
analytics_dashboard/static/js/views/stacked-bar-view.js
View file @
424ad4f6
...
@@ -19,7 +19,8 @@ define(['nvd3', 'underscore', 'views/discrete-bar-view'],
...
@@ -19,7 +19,8 @@ define(['nvd3', 'underscore', 'views/discrete-bar-view'],
chart
.
stacked
(
true
)
chart
.
stacked
(
true
)
.
showControls
(
false
)
.
showControls
(
false
)
.
showLegend
(
false
);
.
showLegend
(
false
)
.
reduceXTicks
(
false
);
// shows all ticks
chart
.
tooltipContent
(
function
(
key
,
x
,
y
,
e
)
{
chart
.
tooltipContent
(
function
(
key
,
x
,
y
,
e
)
{
var
tips
=
[];
var
tips
=
[];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment