質問編集履歴

2

情報追加

2019/10/15 15:24

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -97,163 +97,3 @@
97
97
  ■要素1:5
98
98
 
99
99
  ■要素2:1.5
100
-
101
-
102
-
103
- 詳しい方アドバイス頂けると助かります。![イメージ説明](78fbcf966eddd040ed06ffc78e5b07d1.png)
104
-
105
-
106
-
107
- ```html
108
-
109
- <script>
110
-
111
-
112
-
113
- function thousandsSeparator(value, index, values) {
114
-
115
- value = value.toString().split(/(?=(?:...)*$)/).join(',');
116
-
117
- return value;
118
-
119
- }
120
-
121
-
122
-
123
- var ctx = document.getElementById("BarChart").getContext('2d');
124
-
125
- var DiskChart = new Chart(ctx, {
126
-
127
- type: 'bar',
128
-
129
- data: {
130
-
131
- labels:[
132
-
133
- {% for item in x_label_data %}
134
-
135
- '{{item}}',
136
-
137
- {% endfor %}
138
-
139
- ],
140
-
141
- datasets: [
142
-
143
- {% for product_name in product_list %}
144
-
145
- {
146
-
147
- label: "{{product_name}}",
148
-
149
- data: [
150
-
151
- {% for time_label_data in x_label_data %}
152
-
153
- {% for date, product, total in matrix_list_data %}
154
-
155
- {% if product == product_name %}
156
-
157
- {% if date == time_label_data %}
158
-
159
- {{total}},
160
-
161
- {% endif %}
162
-
163
- {% endif %}
164
-
165
- {% endfor %}
166
-
167
- {% endfor %}
168
-
169
- ],
170
-
171
- },
172
-
173
- {% endfor %}
174
-
175
- ]
176
-
177
- },
178
-
179
- options: {
180
-
181
- responsive: true,
182
-
183
- tooltips: {
184
-
185
- mode: 'nearest',
186
-
187
- intersect: false,
188
-
189
- mode: 'index',
190
-
191
- callbacks: {
192
-
193
- label: (item, data) => {
194
-
195
- const { label } = data.datasets[item.datasetIndex];
196
-
197
- const value = item.value.replace('NaN', '');
198
-
199
- return value && `${label}: ${value}`;
200
-
201
- },
202
-
203
- afterTitle: (items, data) => {
204
-
205
- const values = items.map(e => e.value !== 'NaN' ? +e.value : 0);
206
-
207
- return `合計値: ${values[0] + values[1]}`;
208
-
209
- },
210
-
211
- }
212
-
213
- },
214
-
215
- scales: {
216
-
217
- xAxes: [{
218
-
219
- maxBarThickness: 70,
220
-
221
- stacked: true,
222
-
223
- ticks: {
224
-
225
- autoSkip: true,
226
-
227
- maxRotation:0,
228
-
229
- minRotation:0
230
-
231
- },
232
-
233
- }],
234
-
235
- yAxes: [{
236
-
237
- stacked: true,
238
-
239
- ticks:{
240
-
241
- min: 0,
242
-
243
- userCallback: thousandsSeparator,
244
-
245
- }
246
-
247
- }],
248
-
249
- }
250
-
251
- }
252
-
253
- });
254
-
255
- </script>
256
-
257
-
258
-
259
- ```

1

情報の修正

2019/10/15 15:24

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -101,3 +101,159 @@
101
101
 
102
102
 
103
103
  詳しい方アドバイス頂けると助かります。![イメージ説明](78fbcf966eddd040ed06ffc78e5b07d1.png)
104
+
105
+
106
+
107
+ ```html
108
+
109
+ <script>
110
+
111
+
112
+
113
+ function thousandsSeparator(value, index, values) {
114
+
115
+ value = value.toString().split(/(?=(?:...)*$)/).join(',');
116
+
117
+ return value;
118
+
119
+ }
120
+
121
+
122
+
123
+ var ctx = document.getElementById("BarChart").getContext('2d');
124
+
125
+ var DiskChart = new Chart(ctx, {
126
+
127
+ type: 'bar',
128
+
129
+ data: {
130
+
131
+ labels:[
132
+
133
+ {% for item in x_label_data %}
134
+
135
+ '{{item}}',
136
+
137
+ {% endfor %}
138
+
139
+ ],
140
+
141
+ datasets: [
142
+
143
+ {% for product_name in product_list %}
144
+
145
+ {
146
+
147
+ label: "{{product_name}}",
148
+
149
+ data: [
150
+
151
+ {% for time_label_data in x_label_data %}
152
+
153
+ {% for date, product, total in matrix_list_data %}
154
+
155
+ {% if product == product_name %}
156
+
157
+ {% if date == time_label_data %}
158
+
159
+ {{total}},
160
+
161
+ {% endif %}
162
+
163
+ {% endif %}
164
+
165
+ {% endfor %}
166
+
167
+ {% endfor %}
168
+
169
+ ],
170
+
171
+ },
172
+
173
+ {% endfor %}
174
+
175
+ ]
176
+
177
+ },
178
+
179
+ options: {
180
+
181
+ responsive: true,
182
+
183
+ tooltips: {
184
+
185
+ mode: 'nearest',
186
+
187
+ intersect: false,
188
+
189
+ mode: 'index',
190
+
191
+ callbacks: {
192
+
193
+ label: (item, data) => {
194
+
195
+ const { label } = data.datasets[item.datasetIndex];
196
+
197
+ const value = item.value.replace('NaN', '');
198
+
199
+ return value && `${label}: ${value}`;
200
+
201
+ },
202
+
203
+ afterTitle: (items, data) => {
204
+
205
+ const values = items.map(e => e.value !== 'NaN' ? +e.value : 0);
206
+
207
+ return `合計値: ${values[0] + values[1]}`;
208
+
209
+ },
210
+
211
+ }
212
+
213
+ },
214
+
215
+ scales: {
216
+
217
+ xAxes: [{
218
+
219
+ maxBarThickness: 70,
220
+
221
+ stacked: true,
222
+
223
+ ticks: {
224
+
225
+ autoSkip: true,
226
+
227
+ maxRotation:0,
228
+
229
+ minRotation:0
230
+
231
+ },
232
+
233
+ }],
234
+
235
+ yAxes: [{
236
+
237
+ stacked: true,
238
+
239
+ ticks:{
240
+
241
+ min: 0,
242
+
243
+ userCallback: thousandsSeparator,
244
+
245
+ }
246
+
247
+ }],
248
+
249
+ }
250
+
251
+ }
252
+
253
+ });
254
+
255
+ </script>
256
+
257
+
258
+
259
+ ```