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

Simple Line Graph looks terrible -- formatting help

1 Answer 13 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 05 Mar 2014, 07:28 AM
Hello,

I'm new to the Telerik/KendoUI grid and I'm trying to render a line graph via JavaScript in my MVC View.  I've passed the values and they're producing funky results, so I tried hard-coding some simple integers in and... that's now working.  But whenever I put in my Model data, the graph looks awful.  It's a graph for a full day, 24 hours; I know that's a lot of data points, but there must be some way to make it look better.  Below is the code for the Model-based chart and I've included a pic of the graph with its values.  Series1 (today) and Series 2 (yesterday) are the plotted points and Series 3 should be the x-axis [hour]:  

Screenshot:  http://imgur.com/vADrBAo

Any help would be greatly appreciated!


 
01.    var today = '@Html.Raw(Json.Encode(@Model.ApprovedToday))';
02.    var yesterday = '@Html.Raw(Json.Encode(@Model.ApprovedYesterday))';
03. 
04.    /**************HARD-CODED VALUES ***********/
05.    //testing
06.    //today = new Array(1, 5, 3, 11, 17);
07.    //yesterday = new Array(7, 4, 22, 11, 0);
08. 
09.    $('#chartNew2').kendoChart({
10.        theme: 'metro',
11.        seriesDefaults: {
12.            type: 'line',
13.            style: 'smooth'
14.            //type: 'column',
15.            //stack: true
16.        },
17.        series: [
18.            {
19.                name: 'Today',
20.                data: today,
21.                color: '#609'
22.            },
23.            {
24.                name: 'Yesterday',
25.                data: yesterday,
26.                color: '#f03'
27.            }
28.        ]
29.    });
30.});

[/code]

1 Answer, 1 is accepted

Sort by
0
Iliana Nikolova
Telerik team
answered on 06 Mar 2014, 08:25 AM
Hello Justin,

The provided configuration looks OK (jsBin example), however it is incomplete and I am not able to determine the reason for the illustrated issue. Is it possible to provide an isolated runnable example which reproduces the issue and which I can test locally? This way I would be able to check what exactly is gong wrong and provide concrete recommendations. Thank you in advance for your time and cooperation.

Regards,
Iliana Nikolova
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

Tags
Charts
Asked by
Justin
Top achievements
Rank 1
Answers by
Iliana Nikolova
Telerik team
Share this question
or