New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order Of Data Along Axis #77

Closed
fpcorso opened this Issue Sep 4, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@fpcorso
Copy link

fpcorso commented Sep 4, 2015

Hey Guys! I really like the framework. Very flexible and powerful. However, I am having trouble ordering the data. I am passing an array of objects as my data that is setup something like this:

var data = [{
type:'us', count:5, date: 'Wed Sep 2nd'
},
type:'us', count:8, date: 'Thu Sep 3rd'
}]

Then, I am passing creating a line graph like this:

var Chart = new tauCharts.Chart({
    guide:{
      padding:{l:70, t:10, b:70,r:10},
      showGridLines:'xy',
      color:{
        brewer:{
          us:'color-us'
        }
      },
      y:{
        label:{
          text:'',
          padding:50
        }
      },
      x:{
        label:''
      }
    },
    data: data,
    type: 'line',
    x: 'date',
    y: 'count',
    color: 'type',
  });

The issue is that tauCharts re-arranges my array to make the date alphabetical order. So, the graph shows Thu Sept 3rd before Wed Sep 2nd. I tried to add dimensions using your documentation and setting it like this and then passing a JavaScript Date as the date:

dimensions: {
      date    : { type: 'measure', scale: 'time' },
      count     : { type: 'measure' }
    },

but then the labels along the X axis are not formatted the way I would like. For example, it says Tue 29, Aug 30, Thu 31, September, Wed 2, Thu 3. I would rather have them all formatted the same way.

Is there not a way to have the labels exactly like the data I am passing through and not re-arrange the date? Alternatively, is there a way to set a standard format when scaling using time?

@vladminsky

This comment has been minimized.

Copy link
Contributor

vladminsky commented Sep 4, 2015

Hi @fpcorso,

Line chart attempts to order data by X by default. Looks like we shouldn't do that for ordinal labels. Will fix that in next release.

Currently use workaround by setting "lineOrientation" to "none". This should prevent chart from forcing any ordering:

{
   type: 'line',
   lineOrientation: 'none',
   ...
}

For details on custom formatting look at the following section in the documentation:
http://api.taucharts.com/basic/guide.html#ticks

Thanks for using Taucharts! Share feedback and don't hesitate to ask questions.

vladminsky added a commit that referenced this issue Sep 7, 2015

@vladminsky

This comment has been minimized.

Copy link
Contributor

vladminsky commented Oct 15, 2015

0.6.2

@vladminsky vladminsky closed this Oct 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment