|
1 | | -import React from 'react'; |
2 | | -import { Bar } from 'react-chartjs-2'; |
| 1 | +import React, { Component } from 'react'; |
| 2 | +import Bar from 'react-chartjs-2'; |
3 | 3 |
|
| 4 | +class Mood extends Component { |
| 5 | + constructor(props) { |
| 6 | + super(props); |
| 7 | + this.state = { |
| 8 | + emotionData: { |
| 9 | + labels: ['Anger', 'Joy', 'Disgust', 'Sadness', 'Fear'], |
| 10 | + datasets: [{ |
| 11 | + // label: props.songNameAndArtist[0] + ' - ' + props.songNameAndArtist[1], |
| 12 | + label: '12345', |
| 13 | + data: [ |
| 14 | + 1.5, |
| 15 | + 2.0, |
| 16 | + 3.3, |
| 17 | + 5, |
| 18 | + 10, |
| 19 | + // props.watson.anger, |
| 20 | + // props.watson.joy, |
| 21 | + // props.watson.disgust, |
| 22 | + // props.watson.fear, |
| 23 | + // props.watson.sadness |
| 24 | + ], |
| 25 | + backgroundColor: [ |
| 26 | + 'rgba(252, 61, 57, 1)', |
| 27 | + 'rgba(254, 203, 46, 1)', |
| 28 | + 'rgba(83, 215, 105, 1)', |
| 29 | + 'rgba(20, 126, 251, 1)', |
| 30 | + 'rgba(193, 53, 132, 1)', |
| 31 | + ], |
| 32 | + borderColor: [ |
| 33 | + 'rgba(252, 61, 57, 1)', |
| 34 | + 'rgba(254, 203, 46, 1)', |
| 35 | + 'rgba(83, 215, 105, 1)', |
| 36 | + 'rgba(20, 126, 251, 1)', |
| 37 | + 'rgba(193, 53, 132, 1)', |
| 38 | + ], |
| 39 | + borderWidth: 3, |
| 40 | + }], |
| 41 | + }, |
4 | 42 |
|
| 43 | + emotionOptions: { |
| 44 | + title: { |
| 45 | + display: false, |
| 46 | + text: 'Kanye West - Famous', |
| 47 | + fontSize: 24, |
| 48 | + }, |
| 49 | + }, |
| 50 | + languageData: { |
| 51 | + labels: ['Analytical', 'Confident', 'Tentative'], |
| 52 | + datasets: [{ |
| 53 | + // label: props.songNameAndArtist[0] + ' - ' + props.songNameAndArtist[1], |
| 54 | + label: '54321', |
| 55 | + data: [ |
| 56 | + // props.watson.analytical, props.watson.confident, props.watson.tentative |
| 57 | + 10, |
| 58 | + 1, |
| 59 | + 5, |
| 60 | + 10, |
| 61 | + 20, |
| 62 | + ], |
| 63 | + backgroundColor: [ |
| 64 | + 'rgba(252, 61, 57, 1)', |
| 65 | + 'rgba(254, 203, 46, 1)', |
| 66 | + 'rgba(83, 215, 105, 1)', |
| 67 | + ], |
| 68 | + borderColor: [ |
| 69 | + 'rgba(252, 61, 57, 1)', |
| 70 | + 'rgba(254, 203, 46, 1)', |
| 71 | + 'rgba(83, 215, 105, 1)', |
| 72 | + ], |
| 73 | + borderWidth: 3, |
| 74 | + }], |
| 75 | + }, |
| 76 | + languageOptions: { |
| 77 | + title: { |
| 78 | + display: false, |
| 79 | + // text: props.songNameAndArtist[0] + ' - ' + props.songNameAndArtist[1], |
| 80 | + text: '5555', |
| 81 | + fontSize: 24, |
| 82 | + }, |
| 83 | + }, |
| 84 | + socialData: { |
| 85 | + labels: ["Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Emotional Range"], |
| 86 | + datasets: [{ |
| 87 | + label: 'hahaha', |
| 88 | + data: [ |
| 89 | + 3, |
| 90 | + 2, |
| 91 | + 1, |
| 92 | + 10, |
| 93 | + 5, |
| 94 | + // props.watson.openness, |
| 95 | + // props.watson.conscientiousness, |
| 96 | + // props.watson.extraversion, |
| 97 | + // props.watson.agreeableness, |
| 98 | + // props.watson.emotionalrange |
| 99 | + ], |
| 100 | + backgroundColor: [ |
| 101 | + 'rgba(252, 61, 57, 1)', |
| 102 | + 'rgba(254, 203, 46, 1)', |
| 103 | + 'rgba(83, 215, 105, 1)', |
| 104 | + 'rgba(20, 126, 251, 1)', |
| 105 | + 'rgba(193, 53, 132, 1)', |
| 106 | + ], |
| 107 | + borderColor: [ |
| 108 | + 'rgba(252, 61, 57, 1)', |
| 109 | + 'rgba(254, 203, 46, 1)', |
| 110 | + 'rgba(83, 215, 105, 1)', |
| 111 | + 'rgba(20, 126, 251, 1)', |
| 112 | + 'rgba(193, 53, 132, 1)', |
| 113 | + ], |
| 114 | + borderWidth: 3, |
| 115 | + }], |
| 116 | + }, |
| 117 | + socialOptions: { |
| 118 | + title: { |
| 119 | + display: false, |
| 120 | + text: 'hihi', |
| 121 | + fontSize: 24, |
| 122 | + }, |
| 123 | + }, |
| 124 | + }; |
| 125 | + } |
| 126 | + |
| 127 | + render() { |
| 128 | + return ( |
| 129 | + <div className="maingraph"> |
| 130 | + <h2>Emotion</h2> |
| 131 | + <Bar data={this.state.emotionData} options={this.state.emotionOptions} width={500} /> |
| 132 | + </div> |
| 133 | + ); |
| 134 | + } |
| 135 | +} |
| 136 | + |
| 137 | +export default Mood; |
0 commit comments