This is a migrated thread and some comments may be shown as answers.

Chart Labels Go Off Edge

1 Answer 37 Views
Chart for HTML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stephen
Top achievements
Rank 1
Stephen asked on 27 Nov 2013, 09:35 PM
Hi,

I'm using the RadChart to make a bar chart in an HTML Windows 8 app, but having some problems with labels. The chart doesn't make room for them, so larger values go off the edge of the container. I'm attaching an image of what I'm seeing.

My HTML looks like this:

<div class="m-homepage-sales-yesterday">
    <p class="m-datapair">
        Yesterday's Sales<span class="m-datapair-value">$10,750</span>
    </p>
    <div id="homepage-sales-yesterday-chart"></div>
</div>

My Javascript looks like this:

new Telerik.UI.RadChart(document.getElementById('homepage-sales-yesterday-chart'), {
    categoryAxis: {
        categories: ['Cat1', 'Cat2', 'Cat3'],
        line: { visible: false },
        majorTicks: { visible: false }
    },
    height: 90,
    legend: { visible: false },
    series: [{
        border: { width: 0 },
        data: [8625, 1151, 974],
        gap: 0.2,
        labels: { format: 'c0', visible: true },
        type: 'bar'
    }],
    theme: 'light',
    valueAxis: {
        majorGridLines: { visible: false },
        visible: false
    }
});

Please help. Thanks!

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 28 Nov 2013, 11:03 AM
Hello Stephen,

You can easily fix this by defining a right margin to the chart plot area. With your definition, 30 pixels seem to be enough:
var chart = new Telerik.UI.RadChart(document.getElementById('homepage-sales-yesterday-chart'), {
    categoryAxis: {
        categories: ['Cat1', 'Cat2', 'Cat3'],
        line: { visible: false },
        majorTicks: { visible: false }
    },
    height: 90,
    legend: { visible: false },
    series: [{
        border: { width: 0 },
        data: [8625, 1151, 974],
        gap: 0.2,
        labels: { format: 'c0', visible: true },
        type: 'bar'
    }],
    theme: 'light',
    valueAxis: {
        majorGridLines: { visible: false },
        visible: false
    },
    plotArea: {
        margin: {
            right: 30
        }
    }
});


Regards,
Tsvetina
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart for HTML
Asked by
Stephen
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or