javascript - Justgage.js Change Title,Value,Label font-size - Stack Overflow

I am trying the reduce the font-size using [titleFontSize: 12..] and various binations. but not working.

I am trying the reduce the font-size using [titleFontSize: 12..] and various binations. but not working. same i used for [valueFontSize: ..] & [labelFontSize: ..]

How can i change the font-size of Title,Value & Labels?

Code:

<script src="js/raphael-2.1.4.min.js"></script>
<script src="js/justgage.js">

<script type="text/javascript">
  var gD = new JustGage({
    id: "jgDownload",
    value: 67,
    decimals: 2,
    min: 0,
    max: 1000,
    title: "Download",
    titleFontSize: 12,
    titlePosition: "below",
    titleFontColor: "red",
    titleFontFamily: "Georgia",
    titlePosition: "below",
    valueFontColor: "blue",
    valueFontFamily: "Georgia"
    label: "Mbps",
    lableFontSize: "10px",
    width: 300,
    height: 200,
    relativeGaugeSize: true,
    levelColors: [
          "#E63454",
          "#AC001F",
          "#F6AD37",
          "#B87200",
          "#24A081",
          "#007759",
          "#026071",
          "#015C71"
        ],
    pointer: true,
    counter: true,    
  });
</script>

var gD = new JustGage({
  id: "jgDownload",
  value: 67,
  decimals: 2,
  min: 0,
  max: 1000,
  title: "Download",
  titleFontSize: "5px",
  titlePosition: "below",
  valueFontFamily: "Georgia",
  valueFontSize: "5px",
  label: "Mbps",
  width: 300,
  height: 200,
  relativeGaugeSize: true,
  levelColors: [
    "#E63454",
    "#AC001F",
    "#F6AD37",
    "#B87200",
    "#24A081",
    "#007759",
    "#026071",
    "#015C71"
  ],
  pointer: true,
  counter: true,
});
#divDownloadOuter {
  width: 50%;
  clear: both;
}
<script src=".1.4/raphael-min.js"></script>
<script src=".2.2/justgage.js"></script>
<div id="divDownloadOuter">
  <div id="jgDownload"></div>
</div>

I am trying the reduce the font-size using [titleFontSize: 12..] and various binations. but not working. same i used for [valueFontSize: ..] & [labelFontSize: ..]

How can i change the font-size of Title,Value & Labels?

Code:

<script src="js/raphael-2.1.4.min.js"></script>
<script src="js/justgage.js">

<script type="text/javascript">
  var gD = new JustGage({
    id: "jgDownload",
    value: 67,
    decimals: 2,
    min: 0,
    max: 1000,
    title: "Download",
    titleFontSize: 12,
    titlePosition: "below",
    titleFontColor: "red",
    titleFontFamily: "Georgia",
    titlePosition: "below",
    valueFontColor: "blue",
    valueFontFamily: "Georgia"
    label: "Mbps",
    lableFontSize: "10px",
    width: 300,
    height: 200,
    relativeGaugeSize: true,
    levelColors: [
          "#E63454",
          "#AC001F",
          "#F6AD37",
          "#B87200",
          "#24A081",
          "#007759",
          "#026071",
          "#015C71"
        ],
    pointer: true,
    counter: true,    
  });
</script>

var gD = new JustGage({
  id: "jgDownload",
  value: 67,
  decimals: 2,
  min: 0,
  max: 1000,
  title: "Download",
  titleFontSize: "5px",
  titlePosition: "below",
  valueFontFamily: "Georgia",
  valueFontSize: "5px",
  label: "Mbps",
  width: 300,
  height: 200,
  relativeGaugeSize: true,
  levelColors: [
    "#E63454",
    "#AC001F",
    "#F6AD37",
    "#B87200",
    "#24A081",
    "#007759",
    "#026071",
    "#015C71"
  ],
  pointer: true,
  counter: true,
});
#divDownloadOuter {
  width: 50%;
  clear: both;
}
<script src="https://cdnjs.cloudflare./ajax/libs/raphael/2.1.4/raphael-min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/justgage/1.2.2/justgage.js"></script>
<div id="divDownloadOuter">
  <div id="jgDownload"></div>
</div>

JSFiddle: Link

Share edited Jun 7, 2016 at 9:10 Amit Shah asked Jun 7, 2016 at 8:12 Amit ShahAmit Shah 8,1995 gold badges44 silver badges60 bronze badges 2
  • Try this, may be work titleTextStyle: {fontSize: 12} – Priyank Dey Commented Jun 7, 2016 at 8:22
  • @PriyankDey thanks for try but NOT WORKING. i have attached code snippet and jsfiddle link for your experiments. – Amit Shah Commented Jun 7, 2016 at 9:11
Add a ment  | 

3 Answers 3

Reset to default 4

Try with titleMinFontSize. It will work.

titleMinFontSize: 20,

Check this link for other attributes.

Solution using CSS:

/* Title */
#jgDownload text:nth-child(6) tspan{
  font-size: 0.8em !important;  
}

/* Value */
#jgDownload text:nth-child(7) tspan{
  font-size: 0.5em !important;  
}

/* Label */
#jgDownload text:nth-child(8) tspan, #jgDownload text:nth-child(9) tspan, #jgDownload text:nth-child(10) tspan{
  font-size: 0.9em !important;  
}

Check this link with Example: https://jsfiddle/amitshahc/gf0gm69j/5/

To get it working with justGage v1.2.2 I used the following:

/* Value */
#jgDownload > svg:nth-child(1) > text:nth-child(6) {
    font-size: 0.8em !important;
}

(the 'text:nth-child' value dictates which element to change, i.e. text:nth-child(8) and text:nth-child(9) represents the labels)

Be gentle on me as this is my first post!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1741580984a4354762.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信