Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
charts
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
charts
Commits
daa16b02
Commit
daa16b02
authored
7 years ago
by
Daniel Cothran
Browse files
Options
Downloads
Patches
Plain Diff
Issue #2947190 by zinalacina, andileco: C3 Charts donut Chart Doesn't Render Properly
parent
242ef85b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/charts_c3/src/Plugin/chart/C3.php
+1
-1
1 addition, 1 deletion
modules/charts_c3/src/Plugin/chart/C3.php
modules/charts_google/src/Plugin/chart/Google.php
+23
-4
23 additions, 4 deletions
modules/charts_google/src/Plugin/chart/Google.php
with
24 additions
and
5 deletions
modules/charts_c3/src/Plugin/chart/C3.php
+
1
−
1
View file @
daa16b02
...
...
@@ -45,7 +45,7 @@ class C3 extends AbstractChart {
$attachmentCount
=
count
(
$attachmentDisplayOptions
);
$noAttachmentDisplays
=
$attachmentCount
===
0
;
$types
=
[];
for
(
$i
=
1
;
$i
<=
$attachmentCount
;
$i
++
)
{
if
(
$attachmentDisplayOptions
[
$i
-
1
][
'style'
][
'options'
][
'type'
]
==
'column'
)
{
$types
[
$seriesData
[
$i
][
'name'
]]
=
'bar'
;
...
...
This diff is collapsed.
Click to expand it.
modules/charts_google/src/Plugin/chart/Google.php
+
23
−
4
View file @
daa16b02
...
...
@@ -332,7 +332,7 @@ class Google extends AbstractChart {
$googleOptions
->
setHorizontalAxes
(
$hAxes
);
if
(
in_array
(
'donut'
,
$chartSelected
))
{
$googleOptions
->
pieHole
=
'0.5'
;
$googleOptions
->
pieHole
=
'0.
2
5'
;
}
$chartArea
=
new
ChartArea
();
...
...
@@ -357,10 +357,29 @@ class Google extends AbstractChart {
$chartArea
->
setPaddingLeft
(
$options
[
'chart_area'
][
'left'
]);
}
$seriesCount
=
count
(
$seriesData
);
$categoriesCount
=
count
(
$seriesData
[
0
][
'data'
]);
$seriesColors
=
[];
for
(
$i
=
0
;
$i
<
count
(
$seriesData
);
$i
++
)
{
$seriesColor
=
$seriesData
[
$i
][
'color'
];
array_push
(
$seriesColors
,
$seriesColor
);
if
(
$options
[
'type'
]
==
'pie'
||
$options
[
'type'
]
==
'donut'
)
{
if
(
$seriesCount
>
1
)
{
for
(
$i
=
0
;
$i
<
$seriesCount
;
$i
++
)
{
$seriesColor
=
$seriesData
[
$i
][
'color'
];
array_push
(
$seriesColors
,
$seriesColor
);
}
}
else
{
for
(
$i
=
0
;
$i
<
$categoriesCount
;
$i
++
)
{
// Use default colors if only one series.
$seriesColor
=
$options
[
'colors'
][
$i
];
array_push
(
$seriesColors
,
$seriesColor
);
}
}
}
else
{
for
(
$i
=
0
;
$i
<
$seriesCount
;
$i
++
)
{
$seriesColor
=
$seriesData
[
$i
][
'color'
];
array_push
(
$seriesColors
,
$seriesColor
);
}
}
$googleOptions
->
setColors
(
$seriesColors
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment