link graphic in nav

This commit is contained in:
Baptiste Lemoine 2019-11-19 14:53:53 +01:00
parent e81389eae1
commit c0f800ff91
4 changed files with 58 additions and 54 deletions

View File

@ -1,14 +1,14 @@
import { KindComponent } from "../pages/kind/kind.component"; import {KindComponent} from "../pages/kind/kind.component";
import { DatesComponent } from "../pages/dates/dates.component"; import {DatesComponent} from "../pages/dates/dates.component";
import { VisibilityComponent } from "../pages/visibility/visibility.component"; import {VisibilityComponent} from "../pages/visibility/visibility.component";
import { ResumeComponent } from "../pages/resume/resume.component"; import {ResumeComponent} from "../pages/resume/resume.component";
import { PicturesComponent } from "../pages/pictures/pictures.component"; import {PicturesComponent} from "../pages/pictures/pictures.component";
import { EndConfirmationComponent } from "../pages/end-confirmation/end-confirmation.component"; import {EndConfirmationComponent} from "../pages/end-confirmation/end-confirmation.component";
import { AnswersComponent } from "../pages/answers/answers.component"; import {AnswersComponent} from "../pages/answers/answers.component";
import { CreateOrRetrieveComponent } from "../pages/create-or-retrieve/create-or-retrieve.component"; import {CreateOrRetrieveComponent} from "../pages/create-or-retrieve/create-or-retrieve.component";
import { BaseComponent } from "../pages/base-page/base.component"; import {BaseComponent} from "../pages/base-page/base.component";
import { HomeComponent } from "../pages/home/home.component"; import {HomeComponent} from "../pages/home/home.component";
import { PollGraphicComponent } from '../poll-graphic/poll-graphic.component'; import {PollGraphicComponent} from '../poll-graphic/poll-graphic.component';
import {VoteChoiceComponent} from "../vote-choice/vote-choice.component"; import {VoteChoiceComponent} from "../vote-choice/vote-choice.component";
/** /**
@ -28,7 +28,7 @@ export const Routes =
{path: 'step/visibility', component: VisibilityComponent}, {path: 'step/visibility', component: VisibilityComponent},
{path: 'step/resume', component: ResumeComponent}, {path: 'step/resume', component: ResumeComponent},
{path: 'step/end', component: EndConfirmationComponent}, {path: 'step/end', component: EndConfirmationComponent},
{ path: "graphic/:poll", component: PollGraphicComponent }, {path: 'graphic/:poll', component: PollGraphicComponent},
{path: 'votechoice', component: VoteChoiceComponent}, {path: 'votechoice', component: VoteChoiceComponent},
] ]
; ;

View File

@ -3,18 +3,17 @@
name="selector" name="selector"
autofocus="autofocus" autofocus="autofocus"
[(ngModel)]="isColorblind" [(ngModel)]="isColorblind"
(change)="setColorblind()" (change)="toggleColorblind()"
> >
<option value="colorblind"> <option value="true">
{{ "pollGraphic.choiceColorblind" | translate }} {{ "pollGraphic.choiceColorblind" | translate }}
</option> </option>
<option value="notColorblind"> <option value="false">
{{ "pollGraphic.choiceNotColorblind" | translate }} {{ "pollGraphic.choiceNotColorblind" | translate }}
</option> </option>
</select> </select>
{{ "pollGraphic.colorblindText" | translate }} {{ "pollGraphic.colorblindText" | translate }}
<div> <div>
<canvas id="graph" width="100" height="50"></canvas> <canvas id="graph" width="100" height="50"></canvas>
</div> </div>

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core"; import {Component, OnInit} from "@angular/core";
import { Chart } from "chart.js"; import {Chart} from "chart.js";
@Component({ @Component({
selector: "framadate-poll-graphic", selector: "framadate-poll-graphic",
@ -7,7 +7,7 @@ import { Chart } from "chart.js";
styleUrls: ["./poll-graphic.component.scss"] styleUrls: ["./poll-graphic.component.scss"]
}) })
export class PollGraphicComponent implements OnInit { export class PollGraphicComponent implements OnInit {
isColorblind: boolean; isColorblind: boolean = false;
lineChart: Chart; lineChart: Chart;
pollData: any; pollData: any;
yesList: number[] = []; yesList: number[] = [];
@ -15,7 +15,9 @@ export class PollGraphicComponent implements OnInit {
noList: number[] = []; noList: number[] = [];
nbPoll: number = 0; nbPoll: number = 0;
dateList: string[] = []; dateList: string[] = [];
constructor() {}
constructor() {
}
ngOnInit() { ngOnInit() {
var toto = { var toto = {
@ -100,11 +102,11 @@ export class PollGraphicComponent implements OnInit {
] ]
}, },
options: { options: {
legend: { display: false }, legend: {display: false},
scales: { scales: {
xAxes: [ xAxes: [
{ {
gridLines: { drawBorder: false, display: false }, gridLines: {drawBorder: false, display: false},
display: false, display: false,
stacked: true, stacked: true,
ticks: { ticks: {
@ -116,7 +118,7 @@ export class PollGraphicComponent implements OnInit {
], ],
yAxes: [ yAxes: [
{ {
gridLines: { drawBorder: true, display: false }, gridLines: {drawBorder: true, display: false},
display: true, display: true,
stacked: true stacked: true
} }
@ -126,7 +128,7 @@ export class PollGraphicComponent implements OnInit {
}); });
} }
setColorblind() { toggleColorblind() {
this.isColorblind = !this.isColorblind; this.isColorblind = !this.isColorblind;
} }
@ -151,7 +153,7 @@ export class PollGraphicComponent implements OnInit {
initPollCounter() { initPollCounter() {
this.nbPoll++; this.nbPoll++;
this.dateList[this.nbPoll -1] = "jeudi"; this.dateList[this.nbPoll - 1] = "jeudi";
this.maybeList[this.nbPoll - 1] = 0; this.maybeList[this.nbPoll - 1] = 0;
this.yesList[this.nbPoll - 1] = 0; this.yesList[this.nbPoll - 1] = 0;
this.noList[this.nbPoll - 1] = 0; this.noList[this.nbPoll - 1] = 0;

View File

@ -1,29 +1,32 @@
<nav class="choices"> <nav class="choices">
<a [routerLink]="'/step/creation'" i18n> <a [routerLink]="'/step/creation'" i18n>
Création Création
</a> </a>
<a [routerLink]="'/step/date'" i18n> <a [routerLink]="'/step/date'" i18n>
Les Dates Les Dates
</a> </a>
<a [routerLink]="'/step/answers'" i18> <a [routerLink]="'/step/answers'" i18>
Réponses Réponses
</a> </a>
<a [routerLink]="'/step/visibility'" i18n> <a [routerLink]="'/step/visibility'" i18n>
Visibilité Visibilité
</a> </a>
<a [routerLink]="'/step/base'" i18n> <a [routerLink]="'/step/base'" i18n>
Base Base
</a> </a>
<a [routerLink]="'/step/pictures'" i18n> <a [routerLink]="'/step/pictures'" i18n>
Images Images
</a> </a>
<a [routerLink]="'/step/resume'" i18n> <a [routerLink]="'/step/resume'" i18n>
Résumé Résumé
</a> </a>
<a [routerLink]="'/step/kind'" i18n> <a [routerLink]="'/step/kind'" i18n>
Page démo Page démo
</a> </a>
<a [routerLink]="'/home'" i18n> <a [routerLink]="'/graphic/toto'" i18n>
Accueil Graphique
</a> </a>
<a [routerLink]="'/home'" i18n>
Accueil
</a>
</nav> </nav>