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
04926b20
Commit
04926b20
authored
May 08, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix region of data - #221
parent
d2f6fbc5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
c3.js
c3.js
+19
-9
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
04926b20
...
@@ -644,15 +644,24 @@
...
@@ -644,15 +644,24 @@
svgArcExpanded
=
getSvgArcExpanded
();
svgArcExpanded
=
getSvgArcExpanded
();
svgArcExpandedSub
=
getSvgArcExpanded
(
0.98
);
svgArcExpandedSub
=
getSvgArcExpanded
(
0.98
);
}
}
function
getScale
(
min
,
max
,
forTimeseries
)
{
return
(
forTimeseries
?
d3
.
time
.
scale
()
:
d3
.
scale
.
linear
()).
range
([
min
,
max
]);
}
function
getX
(
min
,
max
,
domain
,
offset
)
{
function
getX
(
min
,
max
,
domain
,
offset
)
{
var
scale
=
(
isTimeSeries
?
d3
.
time
.
scale
()
:
d3
.
scale
.
linear
()).
range
([
min
,
max
]),
var
scale
=
getScale
(
min
,
max
,
isTimeSeries
),
//
(isTimeSeries ? d3.time.scale() : d3.scale.linear()).range([min, max]),
_scale
=
domain
?
scale
.
domain
(
domain
)
:
scale
,
key
;
_scale
=
domain
?
scale
.
domain
(
domain
)
:
scale
,
key
;
// Define customized scale if categorized axis
// Define customized scale if categorized axis
if
(
isCategorized
)
{
if
(
isCategorized
)
{
offset
=
offset
||
function
()
{
return
0
;
};
offset
=
offset
||
function
()
{
return
0
;
};
scale
=
function
(
d
)
{
return
Math
.
ceil
(
_scale
(
d
)
+
offset
(
d
));
};
scale
=
function
(
d
,
raw
)
{
var
v
=
_scale
(
d
)
+
offset
(
d
);
return
raw
?
v
:
Math
.
ceil
(
v
);
};
}
else
{
}
else
{
scale
=
function
(
d
)
{
return
Math
.
ceil
(
_scale
(
d
));
};
scale
=
function
(
d
,
raw
)
{
var
v
=
_scale
(
d
);
return
raw
?
v
:
Math
.
ceil
(
v
);
};
}
}
// define functions
// define functions
for
(
key
in
_scale
)
{
for
(
key
in
_scale
)
{
...
@@ -679,7 +688,7 @@
...
@@ -679,7 +688,7 @@
return
scale
;
return
scale
;
}
}
function
getY
(
min
,
max
,
domain
)
{
function
getY
(
min
,
max
,
domain
)
{
var
scale
=
d3
.
scale
.
linear
().
range
([
min
,
max
]
);
var
scale
=
getScale
(
min
,
max
);
if
(
domain
)
{
scale
.
domain
(
domain
);
}
if
(
domain
)
{
scale
.
domain
(
domain
);
}
return
scale
;
return
scale
;
}
}
...
@@ -2312,7 +2321,7 @@
...
@@ -2312,7 +2321,7 @@
function
lineWithRegions
(
d
,
x
,
y
,
_regions
)
{
function
lineWithRegions
(
d
,
x
,
y
,
_regions
)
{
var
prev
=
-
1
,
i
,
j
;
var
prev
=
-
1
,
i
,
j
;
var
s
=
"M"
,
sWithRegion
;
var
s
=
"M"
,
sWithRegion
;
var
xp
,
yp
,
dx
,
dy
,
dd
,
diff
;
var
xp
,
yp
,
dx
,
dy
,
dd
,
diff
,
diffx2
;
var
xValue
,
yValue
;
var
xValue
,
yValue
;
var
regions
=
[];
var
regions
=
[];
...
@@ -2347,26 +2356,27 @@
...
@@ -2347,26 +2356,27 @@
};
};
}
else
{
}
else
{
sWithRegion
=
function
(
d0
,
d1
,
j
,
diff
)
{
sWithRegion
=
function
(
d0
,
d1
,
j
,
diff
)
{
return
"M"
+
x
(
xp
(
j
)
)
+
" "
+
y
(
yp
(
j
))
+
" "
+
x
(
xp
(
j
+
diff
)
)
+
" "
+
y
(
yp
(
j
+
diff
));
return
"M"
+
x
(
xp
(
j
)
,
true
)
+
" "
+
y
(
yp
(
j
))
+
" "
+
x
(
xp
(
j
+
diff
),
true
)
+
" "
+
y
(
yp
(
j
+
diff
));
};
};
}
}
// Generate
// Generate
for
(
i
=
0
;
i
<
d
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
d
.
length
;
i
++
)
{
// Draw as normal
// Draw as normal
if
(
isUndefined
(
regions
)
||
!
isWithinRegions
(
d
[
i
].
x
,
regions
))
{
if
(
isUndefined
(
regions
)
||
!
isWithinRegions
(
d
[
i
].
x
,
regions
))
{
s
+=
" "
+
xValue
(
d
[
i
])
+
" "
+
yValue
(
d
[
i
]);
s
+=
" "
+
xValue
(
d
[
i
])
+
" "
+
yValue
(
d
[
i
]);
}
}
// Draw with region // TODO: Fix for horizotal charts
// Draw with region // TODO: Fix for horizotal charts
else
{
else
{
xp
=
get
X
(
d
[
i
-
1
].
x
,
d
[
i
].
x
);
xp
=
get
Scale
(
d
[
i
-
1
].
x
,
d
[
i
].
x
,
isTimeSeries
);
yp
=
get
Y
(
d
[
i
-
1
].
value
,
d
[
i
].
value
);
yp
=
get
Scale
(
d
[
i
-
1
].
value
,
d
[
i
].
value
);
dx
=
x
(
d
[
i
].
x
)
-
x
(
d
[
i
-
1
].
x
);
dx
=
x
(
d
[
i
].
x
)
-
x
(
d
[
i
-
1
].
x
);
dy
=
y
(
d
[
i
].
value
)
-
y
(
d
[
i
-
1
].
value
);
dy
=
y
(
d
[
i
].
value
)
-
y
(
d
[
i
-
1
].
value
);
dd
=
Math
.
sqrt
(
Math
.
pow
(
dx
,
2
)
+
Math
.
pow
(
dy
,
2
));
dd
=
Math
.
sqrt
(
Math
.
pow
(
dx
,
2
)
+
Math
.
pow
(
dy
,
2
));
diff
=
2
/
dd
;
diff
=
2
/
dd
;
var
diffx2
=
diff
*
2
;
diffx2
=
diff
*
2
;
for
(
j
=
diff
;
j
<=
1
;
j
+=
diffx2
)
{
for
(
j
=
diff
;
j
<=
1
;
j
+=
diffx2
)
{
s
+=
sWithRegion
(
d
[
i
-
1
],
d
[
i
],
j
,
diff
);
s
+=
sWithRegion
(
d
[
i
-
1
],
d
[
i
],
j
,
diff
);
...
...
c3.min.js
View file @
04926b20
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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