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
a61e7a79
Commit
a61e7a79
authored
Jun 09, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix zoom and redraw on category axis
parent
a9f80c4b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
8 deletions
+115
-8
c3.js
c3.js
+2
-7
c3.min.js
c3.min.js
+0
-0
index.html
htdocs/index.html
+12
-1
api_data_colors.html
htdocs/samples/api_data_colors.html
+33
-0
grids.html
htdocs/samples/grids.html
+21
-0
zoom_category.html
htdocs/samples/zoom_category.html
+47
-0
No files found.
c3.js
View file @
a61e7a79
...
...
@@ -700,7 +700,7 @@
subYMin
=
__axis_rotated
?
0
:
height2
;
subYMax
=
__axis_rotated
?
width2
:
1
;
// update scales
x
=
getX
(
xMin
,
xMax
,
forInit
?
undefined
:
x
.
d
omain
(),
function
()
{
return
xAxis
.
tickOffset
();
});
x
=
getX
(
xMin
,
xMax
,
forInit
?
undefined
:
x
.
orgD
omain
(),
function
()
{
return
xAxis
.
tickOffset
();
});
y
=
getY
(
yMin
,
yMax
,
forInit
?
undefined
:
y
.
domain
());
y2
=
getY
(
yMin
,
yMax
,
forInit
?
undefined
:
y2
.
domain
());
subX
=
getX
(
xMin
,
xMax
,
orgXDomain
,
function
(
d
)
{
return
d
%
1
?
0
:
subXAxis
.
tickOffset
();
});
...
...
@@ -750,11 +750,7 @@
scale
[
key
]
=
_scale
[
key
];
}
scale
.
orgDomain
=
function
()
{
var
domain
=
_scale
.
domain
();
if
(
orgXDomain
&&
orgXDomain
[
0
]
===
domain
[
0
]
&&
orgXDomain
[
1
]
<
domain
[
1
])
{
domain
[
1
]
=
orgXDomain
[
1
];
}
return
domain
;
return
_scale
.
domain
();
};
// define custom domain() for categorized axis
if
(
isCategorized
)
{
...
...
@@ -763,7 +759,6 @@
domain
=
this
.
orgDomain
();
return
[
domain
[
0
],
domain
[
1
]
+
1
];
}
orgXDomain
=
domain
;
_scale
.
domain
(
domain
);
return
scale
;
};
...
...
c3.min.js
View file @
a61e7a79
This source diff could not be displayed because it is too large. You can
view the blob
instead.
htdocs/index.html
View file @
a61e7a79
...
...
@@ -326,6 +326,9 @@
<a
href=
"./samples/zoom.html"
>
Enable zoom
</a>
<a
href=
"./samples/zoom.html"
>
Zoom on category axis
</a>
<a
href=
"./samples/zoom_reduction.html"
>
Zoom with reduction
</a>
...
...
@@ -363,7 +366,7 @@
</a>
</div>
<div
class=
"col-md-4"
>
<h3>
g
rid
</h3>
<h3>
G
rid
</h3>
<a
href=
"./samples/api_xgrid_lines.html"
>
Update x grid lines
</a>
...
...
@@ -392,6 +395,14 @@
</a>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-4"
>
<h3>
Data
</h3>
<a
href=
"./samples/api_data_colors.html"
>
Update data color
</a>
</div>
</div>
</div>
</div>
...
...
htdocs/samples/api_data_colors.html
0 → 100644
View file @
a61e7a79
<html>
<head>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/css/c3.css"
>
</head>
<body>
<div
id=
"chart"
></div>
<script
src=
"http://d3js.org/d3.v3.min.js"
charset=
"utf-8"
></script>
<script
src=
"/js/c3.js"
></script>
<script>
var
chart
=
c3
.
generate
({
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
]
],
},
axis
:
{
x
:
{
type
:
'category'
}
}
});
setTimeout
(
function
()
{
chart
.
data
.
colors
({
data1
:
'#000'
});
},
1000
);
</script>
</body>
</html>
htdocs/samples/grids.html
View file @
a61e7a79
...
...
@@ -8,6 +8,7 @@
<div
id=
"chart3"
></div>
<div
id=
"chart4"
></div>
<div
id=
"chart5"
></div>
<div
id=
"chart6"
></div>
<script
src=
"http://d3js.org/d3.v3.min.js"
charset=
"utf-8"
></script>
<script
src=
"/js/c3.js"
></script>
...
...
@@ -85,6 +86,26 @@
}
});
c3
.
generate
({
bindto
:
'#chart6'
,
data
:
{
columns
:
bigData
},
axis
:
{
x
:
{
type
:
'category'
}
},
grid
:
{
x
:
{
show
:
true
},
y
:
{
show
:
true
}
}
});
</script>
</body>
</html>
htdocs/samples/zoom_category.html
0 → 100644
View file @
a61e7a79
<html>
<head>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/css/c3.css"
>
</head>
<body>
<div
id=
"chart"
></div>
<button
onclick=
"load()"
>
Load
</button>
<script
src=
"http://d3js.org/d3.v3.min.js"
charset=
"utf-8"
></script>
<script
src=
"/js/c3.js"
></script>
<script>
var
chart
=
c3
.
generate
({
bindto
:
'#chart'
,
data
:
{
columns
:
[
generateData
(
100
)
],
},
axis
:
{
x
:
{
type
:
'category'
}
},
zoom
:
{
enabled
:
true
},
subchart
:
{
show
:
true
}
});
function
load
()
{
chart
.
load
({
columns
:
[
generateData
(
Math
.
random
()
*
1000
)
],
});
}
function
generateData
(
n
)
{
var
column
=
[
'sample'
];
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
column
.
push
(
Math
.
random
()
*
500
);
}
return
column
;
}
</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