我是Amcharts的初学者,这是我的工作代码笔demo
我保留了
"categoryField": "country"
绘制柱形图。如你所见,我有国家的大名称,它们相互重叠。有没有办法在Amcharts中将这些字体设置为较小的尺寸?感谢任何帮助。
答案 0 :(得分:2)
如果目标是正确显示标签
"categoryAxis": {
"gridPosition": "start",
"gridAlpha": 0,
"tickPosition": "start",
"tickLength": 20,
"labelRotation": 45
},
笔:https://codepen.io/anon/pen/rWRKLy
或者如果您只想减小字体大小。
"categoryAxis": {
"gridPosition": "start",
"gridAlpha": 0,
"tickPosition": "start",
"tickLength": 20,
"fontSize" : 6
},
笔:https://codepen.io/anon/pen/zobaKz
但我会建议去第一个
要了解有关所有可用属性的更多信息,请参阅categoryAxis
的方法答案 1 :(得分:0)
将“autowrap”添加到“categoryAxis”以避免国家/地区名称相互重叠。
ContentResolver cr = getActivity().getApplication().getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String id = cur.getString(cur.getColumnIndex(
ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(
ContactsContract.Contacts.DISPLAY_NAME));
if (Integer.parseInt(cur.getString(cur.getColumnIndex(
ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
Cursor pCur = cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",
new String[]{id}, null);
while (pCur.moveToNext()) {
int phoneType = pCur.getInt(pCur.getColumnIndex(
ContactsContract.CommonDataKinds.Phone.TYPE));
String phoneNumber = pCur.getString(pCur.getColumnIndex(
ContactsContract.CommonDataKinds.Phone.NUMBER));
phoneNumber = phoneNumber.replace(" ","");
phoneNumber = phoneNumber.replace("-","");
boolean addNumber = stringCheck(phoneNumber,symbols);
if (!addNumber){
if (phoneNumber.length() == 10){
addContact(phoneNumber,phoneType,name);
}else if (phoneNumber.length() == 11){
phoneNumber = phoneNumber.substring(1);
addContact(phoneNumber,phoneType,name);
}else if (phoneNumber.length() == 12){
phoneNumber = phoneNumber.substring(2);
addContact(phoneNumber,phoneType,name);
}else if (phoneNumber.length() == 13){
phoneNumber = phoneNumber.substring(3);
addContact(phoneNumber,phoneType,name);
}
}
}
pCur.close();
}
}
}
答案 2 :(得分:0)
答案 3 :(得分:0)
您可以为此目的使用媒体查询,并可以为不同的屏幕编写自己的CSS。检查更新的代码
[https://codepen.io/junaid_jedi/pen/yVwEeO]
您可以根据自己的要求进行更改。