Welcome Guest Search | Active Topics |

Scatter Chart fewer than Five points
GregFoss
#1 Posted : Monday, August 27, 2012 8:27:48 AM(UTC)
Rank: Member

Groups: jQueryChart, Registered
Joined: 6/7/2012(UTC)
Posts: 16

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Has anyone else noticed that if you chart fewer than five points on the scatter chart with the date in the x-axis then it turns the dates in to a time?

Try this...

Code:
<script lang="javascript" type="text/javascript">
var tab1 = [[new Date('01/03/2012'),16.00]];
var tab2 = [[new Date('01/03/2012'),21.00],[new Date('01/09/2012'),23.00]];
var tab3 = [[new Date('01/09/2012'),25.00]];
$(document).ready(function () {
$('#scatter01').jqChart({
axes: [
{ title:'UoM',
  type:'linear',
  location:'left' }
],
series: [
{ title:'PORT 07',
  type:'scatter',
  data: tab1 },
{ title:'PORT 08',
  type:'scatter',
  data: tab2 },
{ title:'PORT 09',
  type:'scatter',
  data: tab3 }
]
});
});
</script>
Dragan
#2 Posted : Monday, August 27, 2012 8:46:05 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Hi,

That depends on the date time interval, which is calculated. If interval becomes ‘hours’ it changes the labels string format.

You can change the string format with:

Code:
axes: [
                    { title: 'UoM',
                        type: 'dateTime',
                        location: 'bottom',
                        labels: { stringFormat: 'm/d/yy' }
                    }
        ],

and in this case the labels won’t turn to a time.

More about the labels formatting you can find here:

http://www.jqchart.com/documentation/userguide/default.aspx#!LabelsFormatting
Best Regards,
Dragan Matek
jqChart Inc.
GregFoss
#3 Posted : Monday, August 27, 2012 2:48:10 PM(UTC)
Rank: Member

Groups: jQueryChart, Registered
Joined: 6/7/2012(UTC)
Posts: 16

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Thanks Dragan!

As a clarification to others...I simply added the bottom label parameter as Dragan suggested like so (below) to force the x-axis not to calculate to time.
Code:
axes: [
{
title:'UoM',
type:'linear',
location:'left'
},
{
location: 'bottom',
type: 'dateTime',
labels: { stringFormat: 'mmmm d, yyyy', angle : 30 }
}
],
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.096 seconds.