简体   繁体   中英

cube.js playground not plotting data correctly

I am using cube.js to compare the change in data over the time by plotting it as a line graph .

Step 1 : After generating cube.js schema successfully , data looks like this:

在此处输入图片说明

Step 2 :

Now, while I am trying to check the line graph, it's showing the line as below . No line is formatted. Unfortunately, it's not working for the bar graph also .

在此处输入图片说明

Moreover, in SQL the data type for the value is : float(10,10) and timestamp

Apart from that, cube.js console has not error trace , rather its working fine :

Performing query: scheduler-0070c129-f83a-45db-ae09-aac6f9858200
Executing SQL: scheduler-0070c129-f83a-45db-ae09-aac6f9858200
--
  SELECT FLOOR((UNIX_TIMESTAMP()) / 10) as refresh_key

Moreover , I tried as below : [all time ,w/o grouping and pivot settings as I need ] , yet no luck , 在此处输入图片说明

However, If I add measure count , the count is plotting the lie not the expected y-axis data as I configured in pivot settings.

在此处输入图片说明

My question is : what's going wrong ?

In the parameters you have specified the timeRange : 'Last 7 Days' and the Grouping to 'Day' . this takes all the records of the same day and groups them so the chart you are viewing is a daily chart. However, to view non-grouped data you can change the grouping to w/o grouping as you did in the first chart.

My goal was to generate a line graph for the change of a numerical value over time:

x-axis: date/time. y-axis: my numerical value.

Cube.js Generated the following schema for my data. The problem with this schema was that String Type was assigned to the age dimension(clearly should be a Number). Moreover ,there are no measures for filed age ,which I am trying to plot.

cube(`ConceptDrifts`, {
  sql: `SELECT * FROM cube.concept_drifts`,
  preAggregations: {
  },
  joins: {
    
  },
  measures: {
    count: {
      type: `count`,
      drillMembers: [date]
    },
    testCount: {
      sql: `test_count`,
      type: `sum`
    }
  },
  dimensions: {
    age: {
      sql: `age`,
      type: `string`
    },
    maxAge: {
      sql: `max_age`,
      type: `string`
    },
    sex: {
      sql: `sex`,
      type: `string`
    },
    sexSd: {
      sql: `sex_sd`,
      type: `string`
    },
    date: {
      sql: `date`,
      type: `time`
    }
  },
  dataSource: `default`
});

Therefore, I changed the schema at /cube/conf/schema# manually

Added new measures a:

   ag :{
     type : `number`,
     sql : `age`,       
     drillMembers : [age]           
    }   

And, changed the type (as number ) in dimensions :

 dimensions: {
    age: {
      sql: `age`,
      type: `number`
    },
    
    maxAge: {
      sql: `max_age`,
      type: `number`
    },
    
    sex: {
      sql: `sex`,
      type: `number`
    },
    
    sexSd: {
      sql: `sex_sd`,
      type: `number`
    },
    
    date: {
      sql: `date`,
      type: `time`
    }
  },
  
  dataSource: `default`
});

As a result, the graph looks like below :

在此处输入图片说明

More reference :

Data Schema Concepts
Drilldowns

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM