parent
4c2759d8c9
commit
341bf89b28
@ -0,0 +1,166 @@
|
||||
import React from 'react';
|
||||
import plotly from 'plotly.js/dist/plotly';
|
||||
import createPlotComponent from 'react-plotly.js/factory';
|
||||
import LoadingScreen from "./LoadingScreen";
|
||||
|
||||
function Bulles (props) {
|
||||
|
||||
// récupération des résultats de l'élection et stockage en tableau
|
||||
const votesBrut = (Object.values(props))[0];
|
||||
|
||||
// déclaration et initialisation des mentions et couleurs
|
||||
const mentionsBrut = ['Passable', 'Assez bien', 'Bien', 'Très bien', 'Excellent'];
|
||||
const couleursBrut = ['#BB9C42', '#AABA44', '#DCDF44', '#B3D849', '#61AD45'];
|
||||
|
||||
//----------- Traitement des données -----------//
|
||||
|
||||
// fonction d'inversement des éléments de tableau
|
||||
function inverse(obj){
|
||||
var retobj = {};
|
||||
for(var key in obj){
|
||||
retobj[obj[key]] = key;
|
||||
}
|
||||
return retobj;
|
||||
}
|
||||
|
||||
// fonction de réduction d'amplitude permettant de conserver une représentation ordinale du nombre de votes sans décalage visuel trop important
|
||||
/*
|
||||
Pattern de calcul :
|
||||
|
||||
Soient Ai, Bi, Ci, Di, Ei les nombres de votes initiaux fournis dans le tableau classé par ordre mélioratif de mention (de Passable à Excellent). Il vient :
|
||||
A = 1
|
||||
B = <{[1 + (Bi/Ai)] / 40} * A>
|
||||
C = <{[1 + (Ci/Bi)] / 40} * B>
|
||||
D = <{[1 + (Di/Ci)] / 40} * C>
|
||||
E = <{[1 + (Ei/Di)] / 40} * D>
|
||||
*/
|
||||
function redAmpli(tab) {
|
||||
var nvTab = [];
|
||||
nvTab[0] = 100;
|
||||
|
||||
for(i = 1; i < tab.length; i++) {
|
||||
nvTab[i] = ( (1 + ((tab[i]/tab[(i-1)]) / 40 ) ) * nvTab[(i-1)]);
|
||||
}
|
||||
return nvTab;
|
||||
}
|
||||
|
||||
|
||||
// déclaration de l'objet votes-mention et votes-couleur
|
||||
var votesMentionNonOrdonnes = {};
|
||||
var votesCouleurNonOrdonnes = {};
|
||||
|
||||
// initialisation votes-mention ordonnés croissants
|
||||
for (var i = 0; i < mentionsBrut.length; i++) {
|
||||
votesMentionNonOrdonnes[votesBrut[i]] = mentionsBrut[i];
|
||||
votesCouleurNonOrdonnes[votesBrut[i]] = couleursBrut[i];
|
||||
}
|
||||
|
||||
// déclaration des mentions-votes par ordre croissant
|
||||
var votesMentionOrdonnes = inverse(votesMentionNonOrdonnes);
|
||||
var votesCouleurOrdonnes = inverse(votesCouleurNonOrdonnes);
|
||||
|
||||
// vérification du nombre de votes classés par ordre croissant et passés initialement en propriétés au composant
|
||||
console.log("Les données transmises au composant concernant le nombre de votes par mention sont : ");
|
||||
console.log(votesBrut);
|
||||
|
||||
// vérification des mentions destinées à être associées aux votes et ordonnées initialement par ordre mélioratif
|
||||
console.log("Les mentions des votes sont classées initialement par ordre mélioratif de la façon suivante :");
|
||||
console.log(mentionsBrut);
|
||||
|
||||
// vérification du nombre de votes classés par ordre croissant
|
||||
console.log("Les mentions-votes classées par ordre croissant de votes sont : ");
|
||||
console.log(votesMentionOrdonnes);
|
||||
|
||||
// séparation des mentions et des votes
|
||||
const mentions = Object.keys(votesMentionOrdonnes);
|
||||
const votes = Object.values(votesMentionOrdonnes);
|
||||
const couleurs = Object.keys(votesCouleurOrdonnes);
|
||||
|
||||
// vérification des mentions et des votes prêts à être traités pour la représentation graphique
|
||||
console.log('La liste des mentions issue du classement par ordre croissant de votes est :');
|
||||
console.log(mentions);
|
||||
console.log('La liste du nombre de votes correspondant, classée par ordre croissant, est :');
|
||||
console.log(votes);
|
||||
|
||||
// déclaration et initialisation des rayons de bulle pour la représentation graphique
|
||||
var rayons = [];
|
||||
rayons = redAmpli(votes)
|
||||
|
||||
// vérification des rayons
|
||||
console.log('La liste des rayons à représenter graphiquement est la suivante :');
|
||||
console.log(rayons);
|
||||
|
||||
// déclaration et initialisation des textes des bulles
|
||||
const texteBulle1 = (mentions[0] + "<br>" + votes[0] + " votes").toString();
|
||||
const texteBulle2 = (mentions[1] + "<br>" + votes[1] + " votes").toString();
|
||||
const texteBulle3 = (mentions[2] + "<br>" + votes[2] + " votes").toString();
|
||||
const texteBulle4 = (mentions[3] + "<br>" + votes[3] + " votes").toString();
|
||||
const texteBulle5 = (mentions[4] + "<br>" + votes[4] + " votes").toString();
|
||||
|
||||
// déclaration et initialisation d'une instance de graphique en bulles
|
||||
// const Plot = createPlotComponent(plotly);
|
||||
const Plot = require('react-plotly.js').default;
|
||||
|
||||
//---------------------------------------------//
|
||||
|
||||
|
||||
|
||||
//----------- Affichage des données -----------//
|
||||
const [loading, setLoading] = React.useState(true);
|
||||
React.useEffect(() =>{
|
||||
setTimeout(() => setLoading(false), 3000);
|
||||
})
|
||||
return (
|
||||
|
||||
// <div>
|
||||
// {!loading ? (
|
||||
// <React.Fragment>
|
||||
<Plot
|
||||
data={[
|
||||
{
|
||||
x: [0.7, 0.6, 0.5, 0.6, 0.7],
|
||||
y: [0.3, 0.4, 0.5, 0.6, 0.5],
|
||||
hovertemplate:
|
||||
'<b>%{text}</b>' +
|
||||
'<extra></extra>',
|
||||
text: [texteBulle1, texteBulle2, texteBulle3, texteBulle4, texteBulle5],
|
||||
showlegend: false,
|
||||
mode: 'markers',
|
||||
marker: {
|
||||
color: [couleurs[0], couleurs[1], couleurs[2], couleurs[3], couleurs[4]],
|
||||
size: rayons
|
||||
}
|
||||
}
|
||||
]}
|
||||
layout={ {
|
||||
width: 600,
|
||||
height: 600,
|
||||
title: 'Nombre de voix par candidat',
|
||||
xaxis: {
|
||||
showgrid: false,
|
||||
showticklabels: false,
|
||||
showline: false,
|
||||
zeroline: false,
|
||||
range: [0, 1]
|
||||
},
|
||||
yaxis: {
|
||||
showgrid: false,
|
||||
showticklabels: false,
|
||||
showline: false,
|
||||
zeroline: false,
|
||||
range: [0, 1]
|
||||
}
|
||||
} }
|
||||
config={{
|
||||
displayModeBar: false // this is the line that hides the bar.
|
||||
}}
|
||||
/>
|
||||
// </React.Fragment>
|
||||
// ) : (
|
||||
// <LoadingScreen />
|
||||
// )}
|
||||
// </div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Bulles;
|
@ -0,0 +1,41 @@
|
||||
import * as React from "react";
|
||||
import * as d3 from "d3";
|
||||
|
||||
function drawChart(svgRef: React.RefObject<SVGSVGElement>) {
|
||||
const data = [12, 5, 6, 6, 9, 10];
|
||||
const h = 120;
|
||||
const w = 250;
|
||||
const svg = d3.select(svgRef.current);
|
||||
|
||||
svg
|
||||
.attr("width", w)
|
||||
.attr("height", h)
|
||||
.style("margin-top", 50)
|
||||
.style("margin-left", 50);
|
||||
|
||||
svg
|
||||
.selectAll("rect")
|
||||
.data(data)
|
||||
.enter()
|
||||
.append("rect")
|
||||
.attr("x", (d, i) => i * 40)
|
||||
.attr("y", (d, i) => h - 10 * d)
|
||||
.attr("width", 20)
|
||||
.attr("height", (d, i) => d * 10)
|
||||
.attr("fill", "steelblue");
|
||||
}
|
||||
|
||||
const Chart: React.FunctionComponent = () => {
|
||||
const svg = React.useRef<SVGSVGElement>(null);
|
||||
React.useEffect(() => {
|
||||
drawChart(svg);
|
||||
}, [svg]);
|
||||
|
||||
return (
|
||||
<div id="chart">
|
||||
<svg ref={svg} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Chart;
|
@ -0,0 +1,21 @@
|
||||
import React, { useRef, useState, useEffect } from 'react';
|
||||
import D3Chart from './D3Chart';
|
||||
|
||||
const ChartWrapper = () => {
|
||||
|
||||
const chartArea = useRef(null);
|
||||
const [chart, setChart] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!chart) {
|
||||
setChart(new D3Chart(chartArea.current));
|
||||
}
|
||||
}, [chart]);
|
||||
|
||||
return (
|
||||
<div ref={chartArea}></div>
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
export default ChartWrapper;
|
@ -0,0 +1,38 @@
|
||||
import * as d3 from 'd3';
|
||||
|
||||
const url = "https://udemy-react-d3.firebaseio.com/tallest_men.json";
|
||||
|
||||
const WIDTH = 800;
|
||||
const HEIGHT = 500;
|
||||
|
||||
export default class D3Chart {
|
||||
constructor(element) {
|
||||
const svg = d3.select(element)
|
||||
.append("svg")
|
||||
.attr("width", 800)
|
||||
.attr("height", 500)
|
||||
|
||||
d3.json(url).then(data => {
|
||||
const max = d3.max(data, d => d.height)
|
||||
const y = d3.scaleLinear()
|
||||
.domain([0, max])
|
||||
.range([0, HEIGHT])
|
||||
|
||||
const x = d3.scaleBand()
|
||||
.domain(data.map(d => d.name))
|
||||
.range([0, WIDTH])
|
||||
.padding(0.4)
|
||||
|
||||
const rects = svg.selectAll("rect")
|
||||
.data(data)
|
||||
|
||||
rects.enter()
|
||||
.append("rect")
|
||||
.attr("x", d => x(d.name))
|
||||
.attr("y", d => HEIGHT - y(d.height))
|
||||
.attr("width", x.bandwidth)
|
||||
.attr("height", d => y(d.height))
|
||||
.attr("fill", "grey")
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
import React from "react"
|
||||
import styled from "styled-components"
|
||||
|
||||
const Screen = styled.div`
|
||||
position: relative;
|
||||
|
||||
opacity: 0;
|
||||
animation: fade 0.4s ease-in forwards;
|
||||
background: black;
|
||||
|
||||
@keyframes fade {
|
||||
0% {
|
||||
opacity: 0.4;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.8;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const Balls = styled.div`
|
||||
display: flex;
|
||||
|
||||
|
||||
.ball {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
border-radius: 50%;
|
||||
background: red;
|
||||
margin: 0 6px 0 0;
|
||||
animation: oscillate 0.7s ease-in forwards infinite;
|
||||
}
|
||||
|
||||
.one {
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
.two {
|
||||
animation-delay: 1s;
|
||||
}
|
||||
.three {
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
@keyframes oscillate {
|
||||
0% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(20px);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
|
||||
const LoadingScreen = () => {
|
||||
return (
|
||||
<Screen>
|
||||
<Balls>
|
||||
|
||||
<div className="ball one"></div>
|
||||
<div className="ball two"></div>
|
||||
<div className="ball three"></div>
|
||||
</Balls>
|
||||
</Screen>
|
||||
);
|
||||
};
|
||||
|
||||
export default LoadingScreen;
|
@ -0,0 +1,62 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import styled from "styled-components";
|
||||
|
||||
const Modal = ({ show, onClose, children, title }) => {
|
||||
|
||||
const handleCloseClick = (e) => {
|
||||
e.preventDefault();
|
||||
onClose();
|
||||
};
|
||||
|
||||
const modalContent = show ? (
|
||||
<StyledModalOverlay>
|
||||
<StyledModal>
|
||||
<StyledModalHeader>
|
||||
<a href="#" onClick={handleCloseClick}>
|
||||
x
|
||||
</a>
|
||||
</StyledModalHeader>
|
||||
{title && <StyledModalTitle>{title}</StyledModalTitle>}
|
||||
<StyledModalBody>{children}</StyledModalBody>
|
||||
</StyledModal>
|
||||
</StyledModalOverlay>
|
||||
) : null;
|
||||
|
||||
|
||||
return (
|
||||
modalContent
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
const StyledModalBody = styled.div`
|
||||
padding-top: 10px;
|
||||
`;
|
||||
|
||||
const StyledModalHeader = styled.div`
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
font-size: 25px;
|
||||
`;
|
||||
|
||||
const StyledModal = styled.div`
|
||||
background: white;
|
||||
width: 500px;
|
||||
height: 600px;
|
||||
border-radius: 15px;
|
||||
padding: 15px;
|
||||
`;
|
||||
const StyledModalOverlay = styled.div`
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
`;
|
||||
|
||||
export default Modal;
|
@ -0,0 +1,37 @@
|
||||
import React, {Fragment} from 'react';
|
||||
import Head from 'next/head';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
|
||||
const Bulles = dynamic(import('./Bulles'), {
|
||||
ssr: false
|
||||
})
|
||||
|
||||
const nbVotesPassables = 15;
|
||||
const nbVotesAssezBien = 200;
|
||||
const nbVotesBien = 389;
|
||||
const nbVotesTresBien = 12;
|
||||
const nbVotesExcellent = 2;
|
||||
|
||||
const resultats = [nbVotesPassables, nbVotesAssezBien, nbVotesBien, nbVotesTresBien, nbVotesExcellent];
|
||||
|
||||
var totalVotes = 0;
|
||||
|
||||
for(var i = 0; i < resultats.length; i++) {
|
||||
totalVotes += resultats[i];
|
||||
}
|
||||
|
||||
function SystemeVote() {
|
||||
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
|
||||
<Bulles donnees={resultats} />
|
||||
<p style={{color: '#000000'}}>Le total des votes est de {totalVotes}.</p>
|
||||
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
export default SystemeVote;
|
@ -0,0 +1,37 @@
|
||||
import { useState } from "react";
|
||||
|
||||
|
||||
|
||||
export default function AddPicture(props) {
|
||||
const [image, setImage] = useState(null);
|
||||
const [createObjectURL, setCreateObjectURL] = useState(null);
|
||||
|
||||
const uploadToClient = (event) => {
|
||||
if (event.target.files && event.target.files[0]) {
|
||||
const i = event.target.files[0];
|
||||
|
||||
setImage(i);
|
||||
setCreateObjectURL(URL.createObjectURL(i));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="ajout-avatar">
|
||||
<div>
|
||||
<div className="avatar-placeholer">
|
||||
<img src={createObjectURL} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="avatar-text">
|
||||
<h4>Photo <span> (facultatif)</span></h4>
|
||||
|
||||
<p>Importer une photo.<br />format : jpg, png, pdf</p>
|
||||
<div className="btn-ajout-avatar">
|
||||
<input type="file" name="myImage" id="myImage" onChange={uploadToClient} />
|
||||
<label className="inputfile" for="myImage">Importer une photo</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
import { useState } from 'react'
|
||||
import { Alert, Button } from 'react-bootstrap';
|
||||
import { faTimes, faExclamationCircle } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
export default function AlertDismissibleExample() {
|
||||
const [show, setShow] = useState(true);
|
||||
|
||||
if (show) {
|
||||
return (
|
||||
<Alert className="preventWarning">
|
||||
<Alert.Heading>
|
||||
<div>
|
||||
<FontAwesomeIcon icon={faExclamationCircle} className="mr-2" />
|
||||
<span>2 candidats minimum</span>
|
||||
</div>
|
||||
<FontAwesomeIcon onClick={() => setShow(false)} icon={faTimes} className="mr-2" />
|
||||
</Alert.Heading>
|
||||
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
/* eslint react/prop-types: 0 */
|
||||
import {useState} from "react";
|
||||
import {Collapse, Navbar, NavbarToggler, Nav, NavItem} from "reactstrap";
|
||||
import Link from "next/link";
|
||||
import Head from "next/head";
|
||||
import {useTranslation} from 'next-i18next'
|
||||
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
||||
import {faRocket} from "@fortawesome/free-solid-svg-icons";
|
||||
import LanguageSelector from "./LanguageSelector";
|
||||
|
||||
|
||||
const Header = () => {
|
||||
const [isOpen, setOpen] = useState(false)
|
||||
|
||||
const toggle = () => setOpen(!isOpen);
|
||||
|
||||
const {t} = useTranslation()
|
||||
return (
|
||||
<>
|
||||
<Head><title>{t("title")}</title></Head>
|
||||
<header>
|
||||
<Navbar color="light" light expand="md">
|
||||
<Link href="/">
|
||||
<a className="navbar-brand">
|
||||
<div className="d-flex flex-row">
|
||||
<div className="align-self-center">
|
||||
<img src="/logos/logo-color.svg" alt="logo" height="32" />
|
||||
</div>
|
||||
<div className="align-self-center ml-2">
|
||||
<div className="logo-text">
|
||||
<h1>
|
||||
{t("Voting platform")}
|
||||
<small>{t("Majority Judgment")}</small>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</Link>
|
||||
<NavbarToggler onClick={toggle} />
|
||||
<Collapse isOpen={isOpen} navbar>
|
||||
<Nav className="ml-auto" navbar>
|
||||
<NavItem>
|
||||
<Link href="/new/">
|
||||
<a className="text-primary nav-link"> <FontAwesomeIcon icon={faRocket} className="mr-2" />
|
||||
{t("Start an election")}
|
||||
</a>
|
||||
</Link>
|
||||
</NavItem>
|
||||
<NavItem style={{width: "80px"}}>
|
||||
<LanguageSelector />
|
||||
</NavItem>
|
||||
</Nav>
|
||||
</Collapse>
|
||||
</Navbar>
|
||||
</header>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Header;
|
@ -0,0 +1,47 @@
|
||||
/* eslint react/prop-types: 0 */
|
||||
import { useState } from "react";
|
||||
import { Container, Row, Col, Nav, NavItem } from "reactstrap";
|
||||
import Link from "next/link";
|
||||
import Head from "next/head";
|
||||
import { useTranslation } from 'next-i18next'
|
||||
|
||||
|
||||
|
||||
export default function HeaderResultResult() {
|
||||
|
||||
;
|
||||
return (
|
||||
|
||||
<Container className="sectionHeaderResult">
|
||||
|
||||
<Row>
|
||||
<Col className="col-md-3">
|
||||
<Row>
|
||||
<Col className="sectionHeaderResultSideCol">
|
||||
<img src="/calendar.svg" />
|
||||
<p>Clos il y a 2 jours</p></Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col className="sectionHeaderResultSideCol"><img src="/avatarBlue.svg" />
|
||||
<p>14 votants</p></Col>
|
||||
</Row>
|
||||
</Col>
|
||||
|
||||
<Col className="sectionHeaderResultMiddleCol col-md-6">
|
||||
<h3>Quel est le meilleur candidat pour les éléctions présidentielle ?</h3>
|
||||
</Col>
|
||||
|
||||
<Col className="col-md-3">
|
||||
<Row>
|
||||
<Col className="sectionHeaderResultSideCol"><img src="/arrowUpload.svg" /><p>Télécharger les résultats</p></Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col className="sectionHeaderResultSideCol"><img src="/arrowL.svg" /><p>Partagez les résultats</p></Col>
|
||||
</Row>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
/* eslint react/prop-types: 0 */
|
||||
import { useState } from "react";
|
||||
import { Container, Row, Col, Nav, NavItem } from "reactstrap";
|
||||
import Link from "next/link";
|
||||
import Head from "next/head";
|
||||
import { useTranslation } from 'next-i18next'
|
||||
|
||||
|
||||
export default function HeaderMobileResult() {
|
||||
|
||||
;
|
||||
return (
|
||||
|
||||
<Container className="sectionHeaderResult">
|
||||
|
||||
<Row className="sectionHeaderResultMiddleCol">
|
||||
<h3>Quel est le meilleur candidat pour les éléctions présidentielle ?</h3>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col className="sectionHeaderResultSideCol">
|
||||
<img src="/calendar.svg" />
|
||||
<p>Clos il y a 2 jours</p>
|
||||
</Col>
|
||||
|
||||
<Col className="sectionHeaderResultSideCol">
|
||||
<img src="/avatarBlue.svg" />
|
||||
<p>14 votants</p>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Container >
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
|
||||
import React from 'react';
|
||||
import HeaderDesktopResult from './HeaderDesktopResult';
|
||||
import HeaderMobileResult from './HeaderMobileResult';
|
||||
import { useMediaQuery } from "react-responsive";
|
||||
|
||||
export default function HeaderResult() {
|
||||
|
||||
const isMobile = useMediaQuery({ query: "(max-width: 800px)" });
|
||||
|
||||
if (isMobile) return <HeaderMobileResult />;
|
||||
|
||||
else return <HeaderDesktopResult />;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import plotly from 'plotly.js/dist/plotly';
|
||||
import createPlotComponent from 'react-plotly.js/factory';
|
||||
|
||||
// const Plot = createPlotComponent(plotly);
|
||||
const Plot = require('react-plotly.js').default;
|
||||
export default () => (
|
||||
<Plot
|
||||
data={[
|
||||
{
|
||||
type: 'bar',
|
||||
x: ['Taubira', 'Hidalgo', 'Mélenchon'],
|
||||
y: [29,150,85]
|
||||
}
|
||||
]}
|
||||
layout={ { width: 1000, height: 500, title: 'Nombre de voix par candidat' } }
|
||||
/>
|
||||
)
|
File diff suppressed because it is too large
Load Diff