Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
c3-closed
Project
Project
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
charts
c3-closed
Commits
7faacd55
Commit
7faacd55
authored
Oct 14, 2015
by
Evgeny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add title
parent
7e3a51fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
2 deletions
+77
-2
Gruntfile.coffee
Gruntfile.coffee
+3
-2
api.title.js
src/api.title.js
+74
-0
No files found.
Gruntfile.coffee
View file @
7faacd55
...
...
@@ -56,6 +56,7 @@ module.exports = (grunt) ->
'src/class.js'
,
'src/util.js'
,
'src/api.focus.js'
,
'src/api.title.js'
,
'src/api.show.js'
,
'src/api.zoom.js'
,
'src/api.load.js'
,
...
...
@@ -105,7 +106,7 @@ module.exports = (grunt) ->
src
:
'c3.css'
dest
:
'c3.min.css'
grunt
.
registerTask
'default'
,
[
'concat'
,
'test'
,
'posttest'
]
grunt
.
registerTask
'default'
,
[
'
jshint'
,
'
concat'
,
'test'
,
'posttest'
]
grunt
.
registerTask
'test'
,
[
'jasmine'
]
grunt
.
registerTask
'build'
,
[
'concat'
,
'posttest'
]
grunt
.
registerTask
'build'
,
[
'
jshint'
,
'
concat'
,
'posttest'
]
grunt
.
registerTask
'posttest'
,
[
'cssmin'
,
'uglify'
]
src/api.title.js
0 → 100644
View file @
7faacd55
c3_chart_fn
.
title
=
function
(
title
,
hasSubs
,
isSub
)
{
var
$$
=
this
.
internal
;
if
(
!
arguments
.
length
)
{
if
(
$$
.
data
.
title
)
{
return
$$
.
data
.
title
.
text
();
}
else
return
undefined
;
}
/* Remove title */
if
(
title
===
null
)
{
$$
.
data
.
title
=
undefined
;
return
;
}
$$
.
config
.
chartTitle
=
title
;
$$
.
api
.
redrawTitle
(
hasSubs
,
isSub
);
};
c3_chart_fn
.
title
.
show
=
function
()
{
var
$$
=
this
.
internal
;
// Add padding for title
$$
.
config
.
padding_top
=
42
;
$$
.
cachedRedraw
({
withLegend
:
true
});
if
(
!
isUndefined
(
$$
.
data
.
title
)){
$$
.
data
.
title
.
style
(
"display"
,
"block"
);
}
};
c3_chart_fn
.
title
.
hide
=
function
()
{
var
$$
=
this
.
internal
;
if
(
$$
.
data
.
title
)
{
$$
.
data
.
title
.
style
(
"display"
,
"none"
);
}
// Remove padding
$$
.
config
.
padding_top
=
0
;
$$
.
cachedRedraw
({
withLegend
:
true
});
};
c3
.
chart
.
fn
.
redrawTitle
=
function
(
hasSubs
,
isSub
){
var
$$
=
this
.
internal
;
var
title
=
$$
.
config
.
chartTitle
;
var
x
=
$$
.
currentWidth
;
if
(
!
hasSubs
)
x
/=
2
;
if
(
isSub
)
x
=
0
;
var
y
=
32
;
if
(
!
$$
.
data
.
title
)
{
$$
.
data
.
title
=
$$
.
svg
.
append
(
'text'
)
.
attr
(
"class"
,
'c3-title'
)
.
attr
(
"text-anchor"
,
'middle'
)
.
attr
(
'x'
,
x
)
.
attr
(
'y'
,
y
);
$$
.
data
.
title
.
append
(
'tspan'
).
text
(
title
);
}
else
{
$$
.
data
.
title
.
text
(
title
)
.
attr
(
'x'
,
x
)
.
attr
(
'y'
,
y
);
}
};
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