Skip to content

Commit

Permalink
Point plot warning fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomansion committed Apr 23, 2024
2 parents 172d540 + 10533e1 commit 9eb2095
Showing 1 changed file with 19 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -719,35 +719,26 @@ export default {
// Check columns type and uniques values
async DoesUserAcceptRisk() {
let colX = this.data.columns[this.columnXindex];
// Get the index of the selected column
let colY = this.data.columns[this.columnYindex];
let colNameX = colX.label;
// Get the name of rhe selected column
let colNameY = colY.label;
let uniquesValX = colX.uniques.length;
// Get uniques values for selected column
let uniquesValY = colY.uniques.length;
let warningMessage = "";
if (colX.type == String && uniquesValX > 1000) {
warningMessage +=
"The column X " +
colNameX +
" has exceeded the recommended 1000 uniques values" +
"(" +
uniquesValX +
")" +
"\n";
}
if (colY.type == Number) return true;
if (colY.type == String && uniquesValY > 100) {
if (colY.type === String && uniquesValY > 1000) {
warningMessage +=
"The column Y " +
"The column " +
colNameY +
" has exceeded the recommended 100 uniques values" +
"(" +
" has exceeded the recommended 1000 unique values (" +
uniquesValY +
")" +
"\n";
").\n";
}
if (warningMessage == "") return true;
Expand Down Expand Up @@ -1173,25 +1164,26 @@ export default {
// Axis selection
async xAxisSelect(index) {
// Check that columns won't result in a performance issue
const userAccept = await this.DoesUserAcceptRisk();
if (!userAccept) return;
this.columnXindex = index;
this.xAxisSelection = false;
this.pointPlotDrawn = false;
this.linePlotDrawn = false;
this.setBins();
},
async yAxisSelect(index) {
// Check that columns won't result in a performance issue
const userAccept = await this.DoesUserAcceptRisk();
if (!userAccept) return;
let previousIndex = this.columnYindex;
this.columnYindex = index;
this.yAxisSelection = false;
this.pointPlotDrawn = false;
this.linePlotDrawn = false;
// Check that columns won't result in a performance issue
const userAccept = await this.DoesUserAcceptRisk();
if (!userAccept) {
// if user doesn't accept get the previous column
this.columnYindex = previousIndex;
return;
}
},
sizeAxisSelect(index) {
this.columnSizeIndex = index;
Expand Down

0 comments on commit 9eb2095

Please sign in to comment.