Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Chart Symfony Bundle
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
One AM
Libraries
Chart Symfony Bundle
Commits
242cbf71
Verified
Commit
242cbf71
authored
4 years ago
by
Luca Sarti
Browse files
Options
Downloads
Patches
Plain Diff
zoom reload functionality
parent
16320954
Branches
Branches containing commit
Tags
1.0.14
push
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Chart/ChartView.php
+2
-0
2 additions, 0 deletions
src/Chart/ChartView.php
src/Resources/views/apex.js.twig
+16
-6
16 additions, 6 deletions
src/Resources/views/apex.js.twig
with
18 additions
and
6 deletions
src/Chart/ChartView.php
+
2
−
0
View file @
242cbf71
...
...
@@ -39,6 +39,7 @@ class ChartView implements ChartViewInterface
'type'
=>
'bar'
,
'height'
=>
null
,
'width'
=>
null
,
'zoomReload'
=>
false
,
'xaxisType'
=>
'category'
,
'renderXFunction'
=>
null
,
'renderYFunction'
=>
null
,
...
...
@@ -51,6 +52,7 @@ class ChartView implements ChartViewInterface
'type'
,
'height'
,
'width'
,
'xaxisType'
,
'colorizer'
]);
$resolver
->
setAllowedTypes
(
'type'
,
'string'
);
$resolver
->
setAllowedTypes
(
'zoomReload'
,
'boolean'
);
$resolver
->
setAllowedTypes
(
'endingShape'
,
'string'
);
$resolver
->
setAllowedTypes
(
'renderXFunction'
,
[
'string'
,
'null'
]);
$resolver
->
setAllowedTypes
(
'renderYFunction'
,
[
'string'
,
'null'
]);
...
...
This diff is collapsed.
Click to expand it.
src/Resources/views/apex.js.twig
+
16
−
6
View file @
242cbf71
...
...
@@ -27,6 +27,16 @@ $(function () {
{%
if
options.width
%}
width:
{{
options.width
}}
,
{%
endif
%}
{%
if
options.zoomReload
%}
events: {
zoomed: function(chartContext, { xaxis }) {
window.location.href = `/admin/date-filter?from=${new Date(xaxis.min).toISOString().slice(0, 10)}
&
to=${new Date(xaxis.max).toISOString().slice(0, 10)}
&
redirectUrl=${window.location.href}`
},
brushScrolled: function(chartContext, { xaxis, yaxis }) {
console.log('brush scrolled', chartContext)
}
}
{%
endif
%}
},
{%
if
options.type
!=
'pie'
%}
series: [
...
...
@@ -82,11 +92,11 @@ $(function () {
type: '
{{
options.xaxisType
|
e
(
'js'
)
}}
',
labels: {
datetimeUTC: false
}
},
{%
if
options.type
==
'bar'
and
series
|
length
>
1
%}
categories: [
{{
series
|
first
.
values
|
keys
|
map
(
value
=>
'\''
~
(
value
|
e
(
'js'
))
~
'\''
)
|
join
(
', '
)
|
raw
}}
],
{%
endif
%}
},
/* xaxis: {
categories: [
{{
labels
|
map
(
value
=>
'\''
~
(
value
|
e
(
'js'
))
~
'\''
)
|
join
(
', '
)
|
raw
}}
],
}, */
{%
endif
%}
yaxis: {
{%
if
options.renderYFunction
%}
...
...
@@ -129,9 +139,9 @@ $(function () {
},
colors: [
{%
for
color
in
colors
%}
'
{{
color
|
e
(
'js'
)
}}
',
'
{{
color
|
e
(
'js'
)
}}
',
{%
endfor
%}
]
,
]
};
var chart = new ApexCharts(document.querySelector('#apex_chart_
{{
chartId
|
e
(
'js'
)
}}
'), options);
...
...
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