mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Visualization fix for real data
This commit is contained in:
parent
1c98c5070a
commit
6c31788402
@ -34,26 +34,26 @@ class CorpusAnalysisApp {
|
||||
.then(
|
||||
cQiCorpus => {
|
||||
this.data.corpus = {o: cQiCorpus};
|
||||
// this.data.corpus.o.getVisualizationData()
|
||||
// .then(
|
||||
// (data) => {
|
||||
// console.log(data);
|
||||
// this.renderGeneralCorpusInfo(data);
|
||||
// this.renderTextInfoList(data);
|
||||
// this.renderTextProportionsGraphic(data);
|
||||
// this.renderWordFrequenciesGraphic(data);
|
||||
// this.renderBoundsGraphic(data);
|
||||
// }
|
||||
// );
|
||||
this.data.corpus.o.getCorpusData()
|
||||
.then(corpusData => {
|
||||
console.log(corpusData);
|
||||
this.renderGeneralCorpusInfo(corpusData);
|
||||
this.renderTextInfoList(corpusData);
|
||||
this.renderTextProportionsGraphic(corpusData);
|
||||
this.renderFrequenciesGraphic(corpusData);
|
||||
this.renderBoundsGraphic(corpusData);
|
||||
});
|
||||
this.data.corpus.o.getVisualizationData()
|
||||
.then(
|
||||
(data) => {
|
||||
console.log(data);
|
||||
this.renderGeneralCorpusInfo(data);
|
||||
this.renderTextInfoList(data);
|
||||
this.renderTextProportionsGraphic(data);
|
||||
this.renderFrequenciesGraphic(data);
|
||||
this.renderBoundsGraphic(data);
|
||||
}
|
||||
);
|
||||
// this.data.corpus.o.getCorpusData()
|
||||
// .then(corpusData => {
|
||||
// console.log(corpusData);
|
||||
// this.renderGeneralCorpusInfo(corpusData);
|
||||
// this.renderTextInfoList(corpusData);
|
||||
// this.renderTextProportionsGraphic(corpusData);
|
||||
// this.renderFrequenciesGraphic(corpusData);
|
||||
// this.renderBoundsGraphic(corpusData);
|
||||
// });
|
||||
// TODO: Don't do this hgere
|
||||
cQiCorpus.updateDb();
|
||||
this.enableActionElements();
|
||||
@ -132,10 +132,8 @@ class CorpusAnalysisApp {
|
||||
let textData = [];
|
||||
for (let i = 0; i < Object.entries(texts).length; i++) {
|
||||
let resource = {
|
||||
// title: "corpusData.values.text[i].title",
|
||||
// publishing_year: "corpusData.lookups.text[i].publishing_year",
|
||||
title: `Text ${i}`,
|
||||
publishing_year: "2023",
|
||||
title: corpusData.values.s_attrs.text[i].title,
|
||||
publishing_year: corpusData.values.s_attrs.text[i].publishing_year,
|
||||
num_tokens: corpusData.s_attrs.text.lexicon[i].counts.token,
|
||||
num_sentences: corpusData.s_attrs.text.lexicon[i].counts.s,
|
||||
num_unique_words: Object.entries(corpusData.s_attrs.text.lexicon[i].freqs.word).length,
|
||||
@ -159,8 +157,7 @@ class CorpusAnalysisApp {
|
||||
let graphData = [
|
||||
{
|
||||
values: texts.map(text => text[1].counts.token),
|
||||
// labels: texts.map(text => `${corpusData.lookups.text[text[0]].title} (${corpusData.lookups.text[text[0]].publishing_year})`),
|
||||
labels: texts.map(text => text[0]),
|
||||
labels: texts.map(text => `${corpusData.values.s_attrs.text[text[0]].title} (${corpusData.values.s_attrs.text[text[0]].publishing_year})`),
|
||||
type: 'pie'
|
||||
}
|
||||
];
|
||||
@ -199,8 +196,7 @@ class CorpusAnalysisApp {
|
||||
|
||||
for (let item of sortedData) {
|
||||
let data = {
|
||||
// x: texts.map(text => `${corpusData.lookups.text[text[0]].title} (${corpusData.lookups.text[text[0]].publishing_year})`),
|
||||
x: texts.map(text => text[0]),
|
||||
x: texts.map(text => `${corpusData.values.s_attrs.text[text[0]].title} (${corpusData.values.s_attrs.text[text[0]].publishing_year})`),
|
||||
y: texts.map(text => text[1].freqs[category][item[0]]),
|
||||
name: corpusData.values.p_attrs[category][item[0]],
|
||||
type: 'bar'
|
||||
@ -220,11 +216,9 @@ class CorpusAnalysisApp {
|
||||
graphData = [{
|
||||
type: 'bar',
|
||||
x: texts.map(text => text[1].bounds[1] - text[1].bounds[0]),
|
||||
// y: texts.map(text => corpusData.lookups.text[text[0]].title),
|
||||
y: texts.map(text => text[0]),
|
||||
y: texts.map(text => corpusData.values.s_attrs.text[text[0]].title),
|
||||
base: texts.map(text => text[1].bounds[0]),
|
||||
// text: texts.map(text => `${corpusData.lookups.text[text[0]].title} (${corpusData.lookups.text[text[0]].publishing_year})`),
|
||||
text: texts.map(text => text[0]),
|
||||
text: texts.map(text => `${corpusData.values.s_attrs.text[text[0]].title} (${corpusData.values.s_attrs.text[text[0]].publishing_year})`),
|
||||
orientation: 'h',
|
||||
hovertemplate: '%{base} - %{x} <br>%{y}',
|
||||
showlegend: false
|
||||
|
@ -103,6 +103,7 @@ class CorpusTextInfoList extends ResourceList {
|
||||
if (sortElement !== clickedSortElement) {
|
||||
sortElement.classList.remove('asc', 'desc');
|
||||
sortElement.style.color = 'black';
|
||||
sortElement.innerHTML = 'arrow_drop_down';
|
||||
};
|
||||
});
|
||||
clickedSortElement.style.color = '#aa9cc9';
|
||||
|
Loading…
Reference in New Issue
Block a user