Justgage.js 更改标题、值、标签 font-size

Justgage.js Change Title,Value,Label font-size

我正在尝试使用 [titleFontSize: 12..] 和各种组合来减少 font-size。但没有工作。 我用于 [valueFontSize: ..] & [labelFontSize: ..]

如何更改标题、值和标签的 font-size?

代码:

<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.com/ajax/libs/raphael/2.1.4/raphael-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/justgage/1.2.2/justgage.js"></script>
<div id="divDownloadOuter">
  <div id="jgDownload"></div>
</div>

JSFiddle:Link

尝试使用 titleMinFontSize。它会起作用。

titleMinFontSize: 20,

检查此 link 其他属性。

使用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;  
}

检查此 link 示例:https://jsfiddle.net/amitshahc/gf0gm69j/5/

为了让它与 justGage v1.2.2 一起工作,我使用了以下内容:

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

('text:nth-child' 值指示要更改的元素,即 text:nth-child(8) 和 text:nth-child(9) 代表标签)

对我温柔一点,因为这是我的第一个 post!