Chart.js: Non numeric y - axis with multiple labels in datasets in bubble chart

Created on 13 Feb 2017  路  5Comments  路  Source: chartjs/Chart.js

Hello Sir, I am trying to plot my json data dynamically in bubble chart where y axis contains or showing string/text and x axis showing date,same as image given below.Kindly guide me what to do to achieve same output

diffbubblechart

Note: To achieve the above graph I tried non numeric y axis concept with multiples label in a dataset but did not achieve it.

for example
xLabels:[],
yLabels:[],
datasets: [{
label: "A",
},{
label: "B",
}]

can u please tell me how to draw non numeric y axis with multiples label in a dataset?

support

Most helpful comment

Thank u very much Sir!!!!! It worked

All 5 comments

sample1.json file

[
{
"date": "01/09/16",
"name": "i1",
"count": 2
},
{
"date": "01/09/16",
"name": "i2",
"count": 2
},
{
"date": "01/09/16",
"name": "i2",
"count": 7
},
{
"date": "01/09/16",
"name": "i3",
"count": 1
},
{
"date": "01/09/16",
"name": "i2",
"count": 11
},
{
"date": "01/09/16",
"name": "i1",
"count": 9
},
{
"date": "01/09/16",
"name": "i2",
"count": 14
},
{
"date": "01/09/16",
"name": "i2",
"count": 9
},
{
"date": "01/09/16",
"name": "i2",
"count": 2
},
{
"date": "01/09/16",
"name": "i1",
"count": 12
},
{
"date": "01/09/16",
"name": "i2",
"count": 57
},
{
"date": "01/09/16",
"name": "i2",
"count": 10
},
{
"date": "01/09/16",
"name": "i1",
"count": 13
},
{
"date": "01/09/16",
"name": "i2",
"count": 8
},
{
"date": "01/09/16",
"name": "i2",
"count": 7
}
]

sample2.json
[
{
"date": "01/09/16",
"country": "b1",
"count": 1
},
{
"date": "01/09/16",
"country": "b2",
"count": 3
},
{
"date": "01/10/16",
"country": "b2",
"count": 1
},
{
"date": "01/11/16",
"country": "b3",
"count": 6
},
{
"date": "01/11/16",
"country": "b4",
"count": 9
},
{
"date": "02/09/16",
"country": "b1",
"count": 3
},
{
"date": "02/09/16",
"country": "b2",
"count": 16
},
{
"date": "02/10/16",
"country": "b5",
"count": 8
},
{
"date": "02/11/16",
"country": "b6",
"count": 4
},
{
"date": "03/09/16",
"country": "b2",
"count": 5
},
{
"date": "03/09/16",
"country": "b1",
"count": 2
},
{
"date": "03/10/16",
"country": "b2",
"count": 62
},
{
"date": "04/09/16",
"country": "b1",
"count": 7
},
{
"date": "04/09/16",
"country": "b3",
"count": 4
},
{
"date": "04/10/16",
"country": "b6",
"count": 6
}
]

The best way to do this might be to change the function that generates tick strings to return from your labels set but keep the underlying data as integers

Hello sir thank u for your reply.i use ticks callback function and return ticks,like the code given below

callback: function(tickValue,index,ticks) {
return ticks[index];
},

but the problem is, it shows the duplicate values of "name" from sample1.json and "country" from samle2.json on y axis

Thank u very much Sir!!!!! It worked

@prags123 can you provide the code for this chart.
Because i need x-axis some string not time
EX: {"x": "Common Outbound",
"y": "78",
"r": "78",}
{"x": "Common Outbound1",
"y": "160",
"r": "160",}
{"x": "Common inbound",
"y": "271",
"r": "271",}
{"x": "Common inbound1",
"y": "800",
"r": "800",}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Woogles picture Woogles  路  3Comments

HeinPauwelyn picture HeinPauwelyn  路  3Comments

frlinw picture frlinw  路  3Comments

benmccann picture benmccann  路  3Comments

nanospeck picture nanospeck  路  3Comments