私は2つの配列を質問と呼び、もう1つは答えと呼んでいます。問題の要素をトップカテゴリと見なしたいと思います。サブカテゴリはanswer
です。それぞれの質問は異なる答えを持つことができます。配列が一致します。私は以下のようにデータを再フォーマットする必要があります。2つの配列のデータを再フォーマットし、カウントを含む
var question =
[ 'Prompteness',
'Prompteness',
'Prompteness',
'Knowledgeable',
'Knowledgeable',
'Knowledgeable',
'Knowledgeable']
var answer =
[ 'On hold too many times',
'On hold too many times',
"Lots of silence",
'Still a little confused',
'Still a little confused',
'Still a little confused',
"They knew nothing" ]
出力例:
{
name : "Prompteness",
value : [{
name : 'On hold too many times',
data : 2
},{
name : "Lots of silence",
data : 1
}]
},{
name : 'Knowledgeable',
value : [{
name : 'Still a little confused',
data : 3
},
name : "They knew nothing",
data : 1
]
}
は、あなたが自分でそれを実行しようとしましたがありますか?あなたがした場合は、あなたのコードを投稿してください – gauss