jQWidgets Forums

jQuery UI Widgets Forums Chart Question About Padding

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 12 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Question About Padding #8794

    snowfi6916
    Member

    I would like to add padding to the descriptions on my chart so that they are not so close to the data values (both x and y axis). For example, on my x-axis I have dates as the data values, and underneath I have the description as “Week”. I would like to give additional padding to “Week” so it is not so close to the dates. I tried using padding, but it didn’t work. Is there code for jqxChart that will add additional padding to the description for both the x and y axis? Thanks.

    Question About Padding #8811

    Dimitar
    Participant

    Hello snowfi6916,

    Here is an example that shows how to increase the distance between the axis descriptions and the values:

    <html lang="en">
    <head>
    <title id='Description'>jQuery Chart Column Series Example</title>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets2.4.2/jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets2.4.2/jqwidgets/jqxchart.js"></script>
    <script type="text/javascript" src="../../jqwidgets2.4.2/jqwidgets/jqxdata.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    // prepare chart data
    var sampleData = [
    { Day: 'Monday', Keith: 30, Erica: 15, George: 25 },
    { Day: 'Tuesday', Keith: 25, Erica: 25, George: 30 },
    { Day: 'Wednesday', Keith: 30, Erica: 20, George: 25 },
    { Day: 'Thursday', Keith: 35, Erica: 25, George: 45 },
    { Day: 'Friday', Keith: 20, Erica: 20, George: 25 },
    { Day: 'Saturday', Keith: 30, Erica: 20, George: 30 },
    { Day: 'Sunday', Keith: 60, Erica: 45, George: 90 }
    ];
    // prepare jqxChart settings
    var settings = {
    title: "Fitness & exercise weekly scorecard",
    description: "Time spent in vigorous exercise",
    padding: { left: 25, top: 25, right: 25, bottom: 25 },
    titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },
    source: sampleData,
    categoryAxis:
    {
    dataField: 'Day',
    showGridLines: false
    },
    colorScheme: 'scheme01',
    seriesGroups:
    [
    {
    type: 'column',
    columnsGapPercent: 30,
    seriesGapPercent: 0,
    valueAxis:
    {
    minValue: 0,
    maxValue: 100,
    unitInterval: 10,
    description: 'Time in minutes'
    },
    series: [
    { dataField: 'Keith', displayText: 'Keith' },
    { dataField: 'Erica', displayText: 'Erica' },
    { dataField: 'George', displayText: 'George' }
    ]
    }
    ]
    };
    // select the chartContainer DIV element and render the chart.
    $('#chartContainer').jqxChart(settings);
    $("textbox").each(function (index) {
    if ($("textbox:eq(" + index + ") span:first-child").hasClass("jqx-chart-axis-description") == true) {
    $("textbox:eq(" + index + ")").css("left", "10px");
    };
    });
    });
    </script>
    </head>
    <body style="background: white;">
    <div id='chartContainer' style="width: 600px; height: 400px" />
    </body>
    </html>

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.