【问题标题】:Zing Chart X-axis are Labels are out of boundZing Chart X-axis are Labels are out of bound
【发布时间】:2022-12-27 06:12:52
【问题描述】:

I am creating a graph using zing Chart. when I populate time in chart x-axis; times goes out of boundary of x-axis as you can show in image. I have tried adding padding and margin to div. I have also tried to reduce the width of Graph still didn't work. I am using time in 24 hour format. I-e year-month-day(space)house:minutes:second -> 2022-10-10 23:24:05 I am passing time array of around 300k points in the above mention format. Can some one tell me what is the issue. I am using zing chart version is 2.9.9 my code

zingchart.DEV.SORTTOKENS = 0;
zingchart.DEV.PLOTSTATS = 0;
zingchart.DEV.RESOURCES = 0;
zingchart.DEV.KEEPSOURCE = 0;
zingchart.DEV.COPYDATA = 0;
zingchart.DEV.MEDIARULES = 0;
zingchart.SYNTAX = 'dashed';

function chart_AngleTime(timeArray,angle_arr) {

    $('#lineChart').remove();
    $('#canvas_div').append(
        // i have tried here to add padding and margin.
        '<div id="lineChart_at" style=" min-height: 400px; height: 500px; max-height: 500px; max-width: 100%;"></div>'
    );

    var configTimeAndAngle = {
        "type": "line",
        legend: {
            layout: "1x1", //row x column // items means in one two we added two items as in legends
            x: "35%",
            y: "6%",
        },
        "preview":{
            "live":true
        },
        plot: {
            mode: 'fast',
        },
        'scale-x': {
            zooming: true,
            labels: timeArray,
            item: {
            'font-size':10
            }
        },
        'scale-y': {
            'auto-fit': true,
            'min-value':0,
            'max-value':360,
            guide: {
                'line-style': "dotted"
            },
            item: {
            'font-size':10
            }
        },
        'crosshair-x': {
            text: 'Time : %kt (X) Freq : %vt (Y).',
            'line-style': 'dashed',
            'line-width': 2,
            'line-color': '#2196F3',
            marker: {
                type: 'triangle',
                size: 5,
                visible: true
            }
        },
        gui: {
            behaviors: [
            {
                id: 'DownloadPDF',
                enabled: 'none'
            },
            {
                id: 'ViewDataTable',
                enabled: 'none'
            },
            {
                id: 'ViewSource',
                enabled: 'none'
            },
            {
                id: 'CrosshairHide',
                enabled: 'all'
            }
            ]
        },
        "series": [
            {
                "values": angle_arr,
                'line-color': "#3366ff",
                'background-color': "#3366ff",
                text: "Angle"
            }
           
        ]
    };

    zingchart.QUOTEDVALUES = true;
    zingchart.render({
        id: "lineChart_at",
        height: "100%",
        width: "100%", // i have tired here to edit the width
        output: "canvas",
        data: configTimeAndAngle
    });

}

【问题讨论】:

  • Hello, do you mind sharing a working demo(feel free to remove any confidential information) in our studio application or or any other JavaScript playground like jsfiddle, codepen, codesandbox etc? It might help us towards your solution. app.zingsoft.com
  • Have you tried setting adjustLayout to true inside the plotarea object?
  • this the my code google drive link

标签: javascript html canvas zingchart


【解决方案1】:

I appliedmargin: 150to the plotarea object and the x-axis labels are within the display as you can see in the attached screenshot and demo.

【讨论】:

    猜你喜欢
    • 2021-01-15
    • 2012-05-10
    • 1970-01-01
    • 2018-12-10
    • 2021-02-06
    • 1970-01-01
    • 2022-12-02
    • 2019-03-16
    • 2020-02-14
    相关资源
    最近更新 更多