具有正常和对数刻度的剑道图

时间:2019-01-28 16:16:33

标签: charts kendo-ui logarithm

我正在尝试创建一个图表,其左侧为普通小数位数,右侧为对数位数。

enter image description here

该样本大致显示了我的结果,唯一缺少的是,在右侧的刻度上,我需要在确切的中点处显示1000Hz的值。 (360行)

function createTympaniHzChart() {
        $("#chart5").kendoChart({
            title: {
                text: "..."                                   

            },
            series: [{
                colorField: "valueColor",
                overlay: { gradient: "none" },
                border: {
                    width: 0,
                    color: ""
                },
                data: [
                    { value: 720, valueColor: "#C60C30" },
                    { value: 355, valueColor: "#FFBE25" },
                    { value: 340, valueColor: "#2EA1FF" }
                ]
            }],
            tooltip: {
                visible: true,
                format: "{0:0}",
                template: "#= value #°"
            },
            categoryAxis: {
                title: {
                    text: "Lorem Ipsum",                       
                    color: "#4D4D4D"
                },
                majorGridLines: {
                    visible: false
                },
                categories: ["A...", "B...", "C..."],
                line: {
                    visible: false
                },
                axisCrossingValues: [0, 10]
            },
            valueAxis: [{
                title: {
                    text: "° Insertion Depth",                        
                    color: "#4D4D4D"
                },
                max: 720,
                majorUnit: 180,
                line: {
                    visible: false
                },
                labels: {
                    format: "{0}°",
                    position: "start"

                }
            },
                {
                    title: {
                        text: "° Pitch (Hz)",                            
                        color: "#4D4D4D"
                    },
                    max: 10000,
                    min: 100,
                    majorUnit:9900,
                    reverse: true,
                    line: {
                        visible: false
                    },
                    labels: {
                        format: "{0}Hz",
                        position: "end"
                    }     

                }
            ]

        });
    }

还有其他方法可以添加此值吗?

1 个答案:

答案 0 :(得分:0)

我设法通过为数据添加自定义功能并在valueAxis中添加 type:“ log” 属性来解决该问题。

将此添加到valueAxis:

data: fibonacciSequence()

功能:

function fibonacciSequence() {

        for (i = 100; i <= 10000; i = i * 10) {

            var fibAxisValues = [];
            fibAxisValues.push(i);

        }
        return fibAxisValues;

    }