Rardar: Hide some of the valueAxis .

1 Answer 49 Views
Charts
JRC.T.6
Top achievements
Rank 1
JRC.T.6 asked on 18 Nov 2024, 02:30 PM
Hello,

I'm trying to configure a radar chart using Kendo UI to display data for our dimensions. The chart should only display three axis values: 0, 40, and 100. These values are the only possible ones for our dimensions, and we'd like to make the chart more readable by displaying only these three values.

I've tried to configure the chart using the following code:


$("#graph").kendoChart({
    title: {
        text: "Dimensions"
    },
    legend: {
        position: "bottom"
    },
    seriesDefaults: {
        type: "radarArea",
        color: "#0033c4"
    },
    series: [{
        name: "",
        data: ["40", "100", "0", "0", "40"]
    }],
    categoryAxis: {
        categories: [
            "Dimension 1", "Dimension 2", "Dimension 3",
            "Dimension 4", "Dimension 5"
        ],
        color: "black",
        majorGridLines: {
            visible: false
        }
    },
    valueAxis: {
        max: 100, 
        min: 0,   
        majorUnit: 20,
        labels: {
            visible:true,
            format: "{0}%"
        },
        majorGridLines: {
            visible: true 
        },
        line: {
            visible: true 
        }
    }
});
However, I'm having trouble finding a way to display only the axis values 0, 40, and 100. I've tried using the majorUnit property to set the major unit of the axis, but it doesn't seem to work as desired. ( If I put 40....i will get 0, 40 and 80 ).

Could you please help me configure the chart to display only the axis values 0, 40, and 100?

Additional Information:
Kendo UI version used: kendoui.for.jquery.2024.3.806.commercial

Thank you !

1 Answer, 1 is accepted

Sort by
0
Jay
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 19 Nov 2024, 07:20 PM

How about using the below for your labels setting? Here's a dojo.

        labels: {
            visual: function(e) {
              if (e.value === 0 || e.value === 40 || e.value === 100) {
                return e.createVisual();
              }
              return null;
            },
            visible:true,
            format: "{0}%"
        },

JRC.T.6
Top achievements
Rank 1
commented on 20 Nov 2024, 04:46 PM

Thanks a million Jay! I was trying all sorts of things and I had completely forgotten to add the createVisual call. I tried returning true/false but wasn't the right thing to do!
Jay
Top achievements
Rank 3
Iron
Iron
Veteran
commented on 20 Nov 2024, 05:20 PM

Yeah, from the documentation example, I figured you had to return some kind of object for the visual, and this seemed the simplest way to do it.
Tags
Charts
Asked by
JRC.T.6
Top achievements
Rank 1
Answers by
Jay
Top achievements
Rank 3
Iron
Iron
Veteran
Share this question
or