Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Explanation Interface
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
S4XAI
Explanation Interface
Commits
fc45382b
Commit
fc45382b
authored
2 years ago
by
Matthieu BELLUCCI
Browse files
Options
Downloads
Patches
Plain Diff
WIP changing bar charts
parent
be7f6d7c
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/BarCharts.js
+66
-0
66 additions, 0 deletions
src/BarCharts.js
src/index.js
+3
-1
3 additions, 1 deletion
src/index.js
with
69 additions
and
1 deletion
src/BarCharts.js
0 → 100644
+
66
−
0
View file @
fc45382b
import
{
Chart
as
ChartJS
,
CategoryScale
,
LinearScale
,
BarElement
,
Title
,
Tooltip
,
Legend
,
}
from
'
chart.js
'
;
import
{
Component
}
from
'
react
'
;
import
{
Bar
}
from
'
react-chartjs-2
'
;
ChartJS
.
register
(
CategoryScale
,
LinearScale
,
BarElement
,
Title
,
Tooltip
,
Legend
);
const
default_options
=
{
indexAxis
:
'
y
'
,
elements
:
{
bar
:
{
borderWidth
:
1
,},
},
responsive
:
true
,
plugins
:
{
legend
:
{
display
:
false
},
},
title
:
{
display
:
false
,
text
:
'
TITLE
'
,
},
};
class
BarChart
extends
Component
{
constructor
(
props
)
{
super
(
props
);
/*
TODO
* Sort data with labels
* Write extractLabels, extractData and extractBGColor
* See if these functions can or should be merged and how to set state if it is.
*/
this
.
state
=
{
options
:
this
.
props
.
options
||
default_options
,
data
:
{
labels
:
extractLabels
(
this
.
props
.
data
),
datasets
:
[{
data
:
extractData
(
this
.
props
.
data
),
borderColor
:
'
black
'
,
backgroundColor
:
extractBGColor
(
this
.
props
.
data
)
}]
},
};
}
}
export
default
BarChart
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/index.js
+
3
−
1
View file @
fc45382b
...
...
@@ -5,6 +5,7 @@ import Image from './Image';
import
BarChart
from
'
./BarChart
'
;
import
Tabs
from
'
./Tabs
'
;
import
Prediction
from
'
./Prediction
'
;
import
{
BarTest
}
from
'
./BarCharts
'
;
//import data from './data.json';
const
data
=
require
(
'
./data.json
'
)
...
...
@@ -13,4 +14,5 @@ const root = document.getElementById('root');
let
arr
=
[
5
,
10
,
2
,
3
,
0
,
100
,
50
];
//ReactDOM.render(<BarChart data={arr}/>, root);
const
pred
=
<
Prediction
data
=
{
data
}
img
=
{
image
}
label
=
"
Trombone
"
/>
ReactDOM
.
render
(
pred
,
root
);
\ No newline at end of file
// ReactDOM.render(pred, root);
ReactDOM
.
render
(
<
BarTest
/>
,
root
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
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