Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Highlighting overlaps in a CBC

Hello,

is there a way to make the level overlaps of a balanced overlap design visible in a questionnaire, e.g. by highlighting them in color? The goal is that the participants see directly during the CBC which attributes are designed with identical levels.

Thank you very much!

Best,
Andrew
asked Nov 15, 2022 by Andrew Bronze (1,335 points)
edited Nov 16, 2022 by Andrew

1 Answer

0 votes
 
Best answer
Please try adding this script to your CBC:

<style>
.identicalLevelAttribute {
    background-color: red;
}

.identicalLevel {
    background-color: blue;
}
</style>

<script>
$(document).ready(function(){
    var attributeLabels = $('#[% QuestionName() %]_div .attribute_label_column');
    var concepts = $('#[% QuestionName() %]_div .cbc_concept:not(.none_concept)');
    for (var i = 0; i < $(attributeLabels).children().length - 1; i++) {
        var levels = $(concepts).children(':nth-child(' + (i + 1) + ')');
        var firstHtml = $(levels).eq(0).html();
        if ($(levels).get().every(x => $(x).html() == firstHtml)) {
            $(attributeLabels).children().eq(i).addClass('identicalLevelAttribute');
            $(levels).addClass('identicalLevel');
        }
    }
})
</script>


Of course, those bright background colors are just an aspect of this as a prototype.  Lines 3 and 7 can be updated to change exactly what visual distinctions you have in mind for attributes that have the same level for all concepts.
answered Nov 16, 2022 by Zachary Platinum Sawtooth Software, Inc. (216,575 points)
selected Nov 17, 2022 by Andrew
Perfect, thank you very much! Works like a charm! Exactly what I was looking for.
...