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
Evgeny
c3-closed
Commits
a4aac3c7
You need to sign in or sign up before continuing.
Commit
a4aac3c7
authored
Apr 22, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable y directed regions - #132
parent
560a519e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
14 deletions
+64
-14
c3.js
c3.js
+38
-12
c3.min.js
c3.min.js
+0
-0
regions.html
htdocs/samples/regions.html
+26
-2
No files found.
c3.js
View file @
a4aac3c7
...
...
@@ -382,7 +382,7 @@
// for main
margin
=
{
top
:
__axis_rotated
?
getHorizontalAxisHeight
(
'y2'
)
:
rotated_padding_top
,
top
:
__axis_rotated
?
getHorizontalAxisHeight
(
'y2'
)
:
0
,
right
:
getCurrentPaddingRight
(),
bottom
:
getHorizontalAxisHeight
(
__axis_rotated
?
'y'
:
'x'
)
+
(
__axis_rotated
?
0
:
__subchart_size_height
)
+
(
isLegendRight
?
0
:
legendHeight
),
left
:
(
__axis_rotated
?
__subchart_size_height
+
rotated_padding_right
:
0
)
+
getCurrentPaddingLeft
()
...
...
@@ -1274,15 +1274,41 @@
//-- Regions --//
function
regionStart
(
d
)
{
return
(
'start'
in
d
)
?
x
(
isTimeSeries
?
parseDate
(
d
.
start
)
:
d
.
start
)
:
0
;
function
regionX
(
d
)
{
var
xPos
,
yScale
=
d
.
axis
===
'y'
?
y
:
y2
;
if
(
d
.
axis
===
'y'
||
d
.
axis
===
'y2'
)
{
xPos
=
__axis_rotated
?
(
'start'
in
d
?
yScale
(
d
.
start
)
:
0
)
:
0
;
}
else
{
xPos
=
__axis_rotated
?
0
:
(
'start'
in
d
?
x
(
isTimeSeries
?
parseDate
(
d
.
start
)
:
d
.
start
)
:
0
);
}
return
xPos
;
}
function
regionY
(
d
)
{
var
yPos
,
yScale
=
d
.
axis
===
'y'
?
y
:
y2
;
if
(
d
.
axis
===
'y'
||
d
.
axis
===
'y2'
)
{
yPos
=
__axis_rotated
?
0
:
(
'end'
in
d
?
yScale
(
d
.
end
)
:
0
);
}
else
{
yPos
=
__axis_rotated
?
(
'start'
in
d
?
x
(
isTimeSeries
?
parseDate
(
d
.
start
)
:
d
.
start
)
:
0
)
:
0
;
}
return
yPos
;
}
function
regionWidth
(
d
)
{
var
start
=
regionStart
(
d
),
end
=
(
'end'
in
d
)
?
x
(
isTimeSeries
?
parseDate
(
d
.
end
)
:
d
.
end
)
:
width
,
w
=
end
-
start
;
return
(
w
<
0
)
?
0
:
w
;
var
start
=
regionX
(
d
),
end
,
yScale
=
d
.
axis
===
'y'
?
y
:
y2
;
if
(
d
.
axis
===
'y'
||
d
.
axis
===
'y2'
)
{
end
=
__axis_rotated
?
(
'end'
in
d
?
yScale
(
d
.
end
)
:
width
)
:
width
;
}
else
{
end
=
__axis_rotated
?
width
:
(
'end'
in
d
?
x
(
isTimeSeries
?
parseDate
(
d
.
end
)
:
d
.
end
)
:
width
);
}
return
end
<
start
?
0
:
end
-
start
;
}
function
regionHeight
(
d
)
{
var
start
=
regionY
(
d
),
end
,
yScale
=
d
.
axis
===
'y'
?
y
:
y2
;
if
(
d
.
axis
===
'y'
||
d
.
axis
===
'y2'
)
{
end
=
__axis_rotated
?
height
:
(
'start'
in
d
?
yScale
(
d
.
start
)
:
height
);
}
else
{
end
=
__axis_rotated
?
(
'end'
in
d
?
x
(
isTimeSeries
?
parseDate
(
d
.
end
)
:
d
.
end
)
:
height
)
:
height
;
}
return
end
<
start
?
0
:
end
-
start
;
}
//-- Data --//
...
...
@@ -3409,10 +3435,10 @@
.
style
(
"fill-opacity"
,
0
);
mainRegion
.
attr
(
'class'
,
classRegion
)
.
attr
(
"x"
,
__axis_rotated
?
0
:
regionStart
)
.
attr
(
"y"
,
__axis_rotated
?
regionStart
:
margin
.
top
)
.
attr
(
"width"
,
__axis_rotated
?
width
:
regionWidth
)
.
attr
(
"height"
,
__axis_rotated
?
regionWidth
:
h
eight
)
.
attr
(
"x"
,
regionX
)
.
attr
(
"y"
,
regionY
)
.
attr
(
"width"
,
regionWidth
)
.
attr
(
"height"
,
regionH
eight
)
.
transition
().
duration
(
duration
)
.
style
(
"fill-opacity"
,
function
(
d
)
{
return
isValue
(
d
.
opacity
)
?
d
.
opacity
:
0.1
;
});
mainRegion
.
exit
().
transition
().
duration
(
duration
)
...
...
c3.min.js
View file @
a4aac3c7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
htdocs/samples/regions.html
View file @
a4aac3c7
...
...
@@ -11,13 +11,37 @@
var
chart
=
c3
.
generate
({
data
:
{
columns
:
[
[
'sample'
,
30
,
200
,
100
,
400
,
150
,
250
]
[
'sample'
,
30
,
200
,
100
,
400
,
150
,
250
,
300
]
]
},
axis
:
{
rotated
:
true
,
y2
:
{
// show: true,
}
},
regions
:
[
{
start
:
2
,
end
:
4
,
class
:
'region1'
}
{
end
:
1
,
class
:
'region1'
},
{
start
:
2
,
end
:
4
,
class
:
'region1'
},
{
start
:
5
,
class
:
'region1'
},
{
end
:
50
,
axis
:
'y'
},
{
start
:
100
,
end
:
200
,
axis
:
'y'
},
{
start
:
300
,
axis
:
'y'
},
],
zoom
:
{
// enabled: true
}
});
/*
setTimeout(function () {
chart.load({
columns: [
['sample', -100, 200, 50, 100, 400, 299]
]
});
}, 1000);
*/
</script>
</body>
</html>
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