我有这样的条形图
我需要在下面绘制水平虚线
我正在使用图表js创建此图。请帮助我画出这个基线。
var ctx = document.getElementById("baseLinebar");
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["25", "60", "15", "30"],
datasets: [{
data: [25, 60, 15, 30],
backgroundColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)'
]
}]
},
options: {
scales: {
xAxes: [{
gridLines: {
display:false
},
barThickness:40
}],
yAxes: [{
gridLines: {
display:false
}
}]
}
}
});
Run Code Online (Sandbox Code Playgroud) 我试图将使用iOS Charts API创建的图形保存到相机胶卷中。仅存在以下功能:
private func saveButton() {
barChartView.save(to: STRING, format: ChartViewBase.ImageFormat, compressionQuality: Double)
}
Run Code Online (Sandbox Code Playgroud)
我应该为“ to”输入哪个值?
我使用了颜色
vAxis: {
title: 'Rating (scale of 1-10)'
, ticks: [{
v: 8.5
, f: 'A'
}, {
v: 4.5
, f: 'B'
}, {
v: 2
, f: 'C'
}]
, gridlines: {
color: "#00FF00"
}
}
Run Code Online (Sandbox Code Playgroud)
如何在网格线中放置多种颜色,我需要a,b和c不同的颜色,
提前致谢
我有一个实现的代码Novacode.LineChart。默认显示的LineChart类型是这种类型:
但是我不想要这种类型的图表,我希望它没有点,像这样:
这是我创建图表的代码:
LineChart c = new LineChart();
c.AddLegend(ChartLegendPosition.Bottom, false);
c.Grouping = Grouping.Stacked;
Run Code Online (Sandbox Code Playgroud)
任何人都知道如何隐藏毛边点并仅显示线条吗?谢谢大家!!
我正在制作一个简单的反应应用程序,我使用Fusioncharts渲染两个图表.正如在Fusioncharts示例中给出的那样,我试图根据来自另一个图表(饼图)的输入来改变一个图表(柱形图)的状态.问题是,我有两个组件的共同祖先.内容是Dash和topcontent的父级.因此饼图在破折号组件中,我使用回调道具(onslice)来调用父组件的函数,并设置父级状态以通过topcontent改变发送到柱形图的支柱.这是代码.
filtercallback(c,k){
console.log("In callback",c,k);
// this shows up which means the call was successful
this.setState({ filtertext: c,filtersource:k },function()
{ // Callback function
console.log("callback by",c,k);
// this doesn't show up and state isn't set
});
Run Code Online (Sandbox Code Playgroud)
无论出于何种原因,国家都没有被设定.包含console.log()的回调也没有记录任何内容.有人可以帮忙吗?
我目前正在做一个需要绘制饼图的项目。我试图使用核心图形来绘制它,而不是使用第三方库。这是绘制饼图的代码。
let circlePath = UIBezierPath(arcCenter: CGPoint(x: self.frame.width/2 + r/8, y: self.frame.height/2 + r/8), radius: r, startAngle: CGFloat(0), endAngle: CGFloat(M_PI * 2 * Double(percent1 / 100)), clockwise: true)
let circlePath2 = UIBezierPath(arcCenter: CGPoint(x: self.frame.width/2 + r/8, y: self.frame.height/2 + r/8), radius: r, startAngle: CGFloat(M_PI * 2 * Double(percent1 / 100)), endAngle: CGFloat(0), clockwise: true)
let shapeLayer = CAShapeLayer()
shapeLayer.path = circlePath.cgPath
let shapeLayer2 = CAShapeLayer()
shapeLayer2.path = circlePath2.cgPath
//change the fill color
shapeLayer.fillColor = UIColor.red.cgColor
shapeLayer2.fillColor = UIColor.blue.cgColor
//you can change …Run Code Online (Sandbox Code Playgroud) 我正在使用chart.js,我想为我的数据设置自定义日期格式.我怎样才能做到这一点?
例如,这是我的x轴日期配置:
scales: {
xAxes: [{
type: 'time',
position: 'bottom',
time: {
displayFormats: {
**'day': 'Y M D',
'week': 'Y M D',
'month': 'Y M D',
'year': 'Y M D',**
}
},
Run Code Online (Sandbox Code Playgroud)
如何控制工具提示和轴刻度标签格式.
我正在用Chart.js绘制一条线.我正在绘制一些价值的时间.我想在轴上修复时隙.我正在使用该stepSize属性,但它不适用.
这是代码:
var data = {
labels: [1495015201000, 1495015202000, 1495015203000, 1495015204000, 1495015205000, 1495015206000, 1495015207000, 1495015208000, 1495015209000, 1495015210000, 1495015211000, 1495015212000, 1495015213000, 1495015214000, 1495015215000, 1495015216000, 1495015217000, 1495015218000, 1495015219000, 1495015220000, 1495015221000, 1495015222000, 1495015223000, 1495015224000, 1495015225000, 1495015226000, 1495015227000, 1495015228000, 1495015229000, 1495015230000, 1495015231000, 1495015232000, 1495015233000, 1495015234000, 1495015235000, 1495015236000, 1495015237000, 1495015238000, 1495015239000, 1495015240000, 1495015241000, 1495015242000, 1495015243000, 1495015244000, 1495015245000, 1495015246000, 1495015247000, 1495015248000, 1495015249000, 1495015250000, 1495015251000, 1495015252000, 1495015253000, 1495015254000, 1495015255000, 1495015256000, 1495015257000, 1495015258000, 1495015259000, 1495015260000],
datasets: [{
label: "DataSet",
backgroundColor: "rgba(255,99,132,0.2)",
borderColor: "rgba(255,99,132,1)",
borderWidth: …Run Code Online (Sandbox Code Playgroud) 我使用下面的matplotlib创建了一个饼图:
labels = ['dogs','cats','birds','fish']
sizes = [34, 24,18,13]
pie = plt.pie(sizes,autopct='%1.1f%%', startangle=90)
plt.axis('equal')
plt.legend( loc = 'right', labels=labels)
plt.show()
Run Code Online (Sandbox Code Playgroud)
(对不起,我不知道如何在这里显示饼图)
有没有办法将这些百分比放在图例中,以便图例显示:
狗,34%
猫,24%
鸟类,18%
鱼,13%
我知道我可以改变"标签"来阅读上面作为最快和最优雅的方式,但是如果在代码运行之前你不知道"大小"怎么办?
charts ×10
javascript ×5
chart.js ×3
chart.js2 ×3
angularjs ×2
ios ×2
jquery ×2
linechart ×2
swift ×2
css ×1
fusioncharts ×1
geometry ×1
html5-canvas ×1
ios-charts ×1
matplotlib ×1
python ×1
reactjs ×1