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
347352d0
Commit
347352d0
authored
Nov 25, 2015
by
Evgeny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with legend in nodejs
parent
d56a4039
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
12 deletions
+34
-12
c3.js
c3.js
+17
-6
c3.min.js
c3.min.js
+0
-0
legend.js
src/legend.js
+17
-6
No files found.
c3.js
View file @
347352d0
...
...
@@ -4161,6 +4161,8 @@
var
hasFocused
=
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItemFocused
).
size
();
var
texts
,
rects
,
tiles
,
background
;
var
nodeOffset
=
typeof
process
===
'undefined'
?
1
:
3
;
options
=
options
||
{};
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
withTransitionForTransform
=
getOption
(
options
,
"withTransitionForTransform"
,
true
);
...
...
@@ -4242,15 +4244,24 @@
$$
.
updateLegendStep
(
step
);
}
function
getMargin
(
i
){
if
(
margins
[
i
]
!==
'undefined'
){
return
margins
[
i
];
}
else
{
return
margins
[
0
];
}
}
if
(
$$
.
isLegendRight
)
{
xForLegend
=
function
(
id
)
{
return
maxWidth
*
steps
[
id
];
};
yForLegend
=
function
(
id
)
{
return
margins
[
steps
[
id
]]
+
offsets
[
id
];
};
xForLegend
=
function
(
id
)
{
return
maxWidth
*
steps
[
id
]
-
2
*
nodeOffset
;
};
yForLegend
=
function
(
id
)
{
return
getMargin
(
steps
[
id
])
+
offsets
[
id
]
*
nodeOffset
};
}
else
if
(
$$
.
isLegendInset
)
{
xForLegend
=
function
(
id
)
{
return
maxWidth
*
steps
[
id
]
+
10
;
};
yForLegend
=
function
(
id
)
{
return
margins
[
steps
[
id
]]
+
offsets
[
id
]
;
};
xForLegend
=
function
(
id
)
{
return
maxWidth
*
steps
[
id
]
+
10
-
2
*
nodeOffset
;
};
yForLegend
=
function
(
id
)
{
return
getMargin
(
steps
[
id
])
+
offsets
[
id
]
*
nodeOffset
;
};
}
else
{
xForLegend
=
function
(
id
)
{
return
margins
[
steps
[
id
]]
+
offsets
[
id
]
;
};
yForLegend
=
function
(
id
)
{
return
maxHeight
*
steps
[
id
];
};
xForLegend
=
function
(
id
)
{
return
getMargin
(
steps
[
id
])
+
offsets
[
id
]
*
nodeOffset
;
};
yForLegend
=
function
(
id
)
{
return
maxHeight
*
steps
[
id
]
-
2
*
nodeOffset
;
};
}
xForLegendText
=
function
(
id
,
i
)
{
return
xForLegend
(
id
,
i
)
+
14
;
};
yForLegendText
=
function
(
id
,
i
)
{
return
yForLegend
(
id
,
i
)
+
9
;
};
...
...
c3.min.js
View file @
347352d0
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/legend.js
View file @
347352d0
...
...
@@ -120,6 +120,8 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
var
hasFocused
=
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItemFocused
).
size
();
var
texts
,
rects
,
tiles
,
background
;
var
nodeOffset
=
typeof
process
===
'undefined'
?
1
:
3
;
options
=
options
||
{};
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
withTransitionForTransform
=
getOption
(
options
,
"withTransitionForTransform"
,
true
);
...
...
@@ -201,15 +203,24 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
$$
.
updateLegendStep
(
step
);
}
function
getMargin
(
i
){
if
(
margins
[
i
]
!==
'undefined'
){
return
margins
[
i
];
}
else
{
return
margins
[
0
];
}
}
if
(
$$
.
isLegendRight
)
{
xForLegend
=
function
(
id
)
{
return
maxWidth
*
steps
[
id
];
};
yForLegend
=
function
(
id
)
{
return
margins
[
steps
[
id
]]
+
offsets
[
id
];
};
xForLegend
=
function
(
id
)
{
return
maxWidth
*
steps
[
id
]
-
2
*
nodeOffset
;
};
yForLegend
=
function
(
id
)
{
return
getMargin
(
steps
[
id
])
+
offsets
[
id
]
*
nodeOffset
};
}
else
if
(
$$
.
isLegendInset
)
{
xForLegend
=
function
(
id
)
{
return
maxWidth
*
steps
[
id
]
+
10
;
};
yForLegend
=
function
(
id
)
{
return
margins
[
steps
[
id
]]
+
offsets
[
id
]
;
};
xForLegend
=
function
(
id
)
{
return
maxWidth
*
steps
[
id
]
+
10
-
2
*
nodeOffset
;
};
yForLegend
=
function
(
id
)
{
return
getMargin
(
steps
[
id
])
+
offsets
[
id
]
*
nodeOffset
;
};
}
else
{
xForLegend
=
function
(
id
)
{
return
margins
[
steps
[
id
]]
+
offsets
[
id
]
;
};
yForLegend
=
function
(
id
)
{
return
maxHeight
*
steps
[
id
];
};
xForLegend
=
function
(
id
)
{
return
getMargin
(
steps
[
id
])
+
offsets
[
id
]
*
nodeOffset
;
};
yForLegend
=
function
(
id
)
{
return
maxHeight
*
steps
[
id
]
-
2
*
nodeOffset
;
};
}
xForLegendText
=
function
(
id
,
i
)
{
return
xForLegend
(
id
,
i
)
+
14
;
};
yForLegendText
=
function
(
id
,
i
)
{
return
yForLegend
(
id
,
i
)
+
9
;
};
...
...
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