【问题标题】:Apexchart: Radar Chart - Problem with showing xaxis labelsApexchart:雷达图 - 显示 xaxis 标签的问题
【发布时间】:2021-09-28 14:19:44
【问题描述】:

我在使用 Apexcharts 的雷达图时遇到了一些问题。我在文档apexcharts.js - basic radar chart 中定义了我的图表,并且在那里显示了 x 轴标签,而在我的版本中它们没有显示。有人知道我该如何处理吗?这是我的代码:

var options = {
    series: [{
        name: 'Rating',
        data: [4.2, 4.8, 3.1, 3.8, 3.5, 2.9],
    }],
    chart: { toolbar: {
            show: false
        },
        height: 350,
        type: 'radar',
    },
    colors: ['#00b0db'],
    xaxis: {
        categories: ['Meals', 'Location', 'Price', 'Features', 'Ambiance', 'Service']
    },
    dataLabels: {
        enabled: true,
        background: {
            enabled: true,
            borderRadius:2,
        }
    },

};

var chart = new ApexCharts(document.querySelector("#radar-chart-categories"), options);
chart.render();

Here a screenshot of my radar chart unfortunately without showing the x-axis labels

【问题讨论】:

    标签: jquery ajax apexcharts radar-chart


    【解决方案1】:

    我用你的数据创建了一个 codepen,它看起来很有效:

    https://codepen.io/welante/pen/dyWqMZK

    window.Apex = {
          tooltip: {
            theme: "dark",
            x: {
              formatter: function (val) {
                return val;
              }
            }
          }
        };
        
        var options = {
            series: [{
                name: 'Rating',
                data: [4.2, 4.8, 3.1, 3.8, 3.5, 2.9],
            }],
            chart: { toolbar: {
                    show: false
                },
                height: 350,
                type: 'radar',
            },
            colors: ['#00b0db'],
            xaxis: {
                categories: ['Meals', 'Location', 'Price', 'Features', 'Ambiance', 'Service']
            },
            dataLabels: {
                enabled: true,
                background: {
                    enabled: true,
                    borderRadius:2,
                }
            },
        
        };
        
        var chart = new ApexCharts(document.querySelector("#radar-chart-categories"), options);
        chart.render();
    

    【讨论】:

    • 正如我们在黑暗模式下看到的那样,它可以工作。但是在灯光模式下它仍然没有。同样在将 xaxis 标签的颜色设置为黑色之后。更改 fontSize,更改深色主题中的 fontSize(将 show 从 true 更改为 false 相同),但颜色不起作用。 x轴的代码:xaxis:{类别:['Meals','Location','Price','Features','Ambiance','Service'],labels:{show:true,style:{colors:[“ #000000"], fontSize: "14px", fontFamily: 'Arial', }, } },
    猜你喜欢
    • 2014-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-13
    • 1970-01-01
    相关资源
    最近更新 更多