Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
D
DV-Project
Project
Project
Details
Activity
Releases
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
almohanad.hafez
DV-Project
Commits
c0f4e780
Commit
c0f4e780
authored
Feb 10, 2025
by
Almouhannad Hafez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix chartConfiguration usage in chart.ts
parent
a379d8c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
chart.ts
src/ts/chart-base/chart.ts
+10
-18
No files found.
src/ts/chart-base/chart.ts
View file @
c0f4e780
...
@@ -2,12 +2,7 @@ import * as d3 from 'd3';
...
@@ -2,12 +2,7 @@ import * as d3 from 'd3';
import
{
ChartConfiguration
}
from
'./chart-configuration'
;
import
{
ChartConfiguration
}
from
'./chart-configuration'
;
export
abstract
class
Chart
{
export
abstract
class
Chart
{
protected
config
:
{
protected
config
:
ChartConfiguration
;
parentSVGElement
:
string
;
containerWidth
:
number
;
containerHeight
:
number
;
margin
:
{
top
:
number
;
right
:
number
;
bottom
:
number
;
left
:
number
;
};
};
public
data
:
any
[];
public
data
:
any
[];
protected
width
:
number
;
protected
width
:
number
;
protected
height
:
number
;
protected
height
:
number
;
...
@@ -24,13 +19,10 @@ export abstract class Chart {
...
@@ -24,13 +19,10 @@ export abstract class Chart {
const
vis
=
this
;
const
vis
=
this
;
// Configuration object with defaults
// Configuration object with defaults
const
{
width
,
height
}
=
_config
.
containerSize
||
vis
.
getDefaultContainerSize
();
vis
.
config
=
new
ChartConfiguration
(
_config
.
parentSVGElement
,
vis
.
config
=
{
_config
.
containerSize
||
vis
.
getDefaultContainerSize
(),
parentSVGElement
:
_config
.
parentSVGElement
,
_config
.
margin
||
vis
.
getDefaultMargins
());
containerWidth
:
width
,
containerHeight
:
height
,
margin
:
_config
.
margin
||
vis
.
getDefaultMargins
()
};
vis
.
data
=
_data
||
[];
vis
.
data
=
_data
||
[];
vis
.
initChart
();
vis
.
initChart
();
}
}
...
@@ -52,18 +44,18 @@ export abstract class Chart {
...
@@ -52,18 +44,18 @@ export abstract class Chart {
const
vis
=
this
;
const
vis
=
this
;
// Calculate inner chart size.
// Calculate inner chart size.
vis
.
width
=
vis
.
config
.
container
Width
-
vis
.
config
.
margin
.
left
-
vis
.
config
.
margin
.
right
;
vis
.
width
=
vis
.
config
.
container
Size
!
.
width
-
vis
.
config
.
margin
!
.
left
-
vis
.
config
.
margin
!
.
right
;
vis
.
height
=
vis
.
config
.
container
Height
-
vis
.
config
.
margin
.
top
-
vis
.
config
.
margin
.
bottom
;
vis
.
height
=
vis
.
config
.
container
Size
!
.
height
-
vis
.
config
.
margin
!
.
top
-
vis
.
config
.
margin
!
.
bottom
;
// Define size of SVG drawing area
// Define size of SVG drawing area
vis
.
svg
=
d3
.
select
(
vis
.
config
.
parentSVGElement
)
vis
.
svg
=
d3
.
select
(
vis
.
config
.
parentSVGElement
)
.
attr
(
'width'
,
vis
.
config
.
container
W
idth
)
.
attr
(
'width'
,
vis
.
config
.
container
Size
!
.
w
idth
)
.
attr
(
'height'
,
vis
.
config
.
container
H
eight
);
.
attr
(
'height'
,
vis
.
config
.
container
Size
!
.
h
eight
);
// Append group element that will contain our actual chart
// Append group element that will contain our actual chart
// and position it according to the given margin config
// and position it according to the given margin config
vis
.
chart
=
vis
.
svg
.
append
(
'g'
)
vis
.
chart
=
vis
.
svg
.
append
(
'g'
)
.
attr
(
'transform'
,
`translate(
${
vis
.
config
.
margin
.
left
}
,
${
vis
.
config
.
margin
.
top
}
)`
);
.
attr
(
'transform'
,
`translate(
${
vis
.
config
.
margin
!
.
left
}
,
${
vis
.
config
.
margin
!
.
top
}
)`
);
}
}
/**
/**
...
...
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