我正在寻找一个HTML/javascript的蜘蛛图/雷达图表,它也是交互式的.我希望用户移动所有端点并存储最终结果.
我一直在寻找一段时间,虽然我发现了一些不错的图表组件,所有这些组件都是静态的,只能使用代码进行更新.
有人可以帮我删除在我的极坐标图中形成环的网格线。我想保留(甚至加粗)轴并为每个轴标签添加刻度。
这是我正在使用的代码、绘图图像以及我想要的轴图像。
import numpy as np
import pylab as pl
import matplotlib.pyplot as py
class Radar(object):
def __init__(self, fig, titles, labels, rect=None):
if rect is None:
rect = [0.05, 0.05, 0.95, 0.95]
self.n = len(titles)
self.angles = [a if a <=360. else a - 360. for a in np.arange(90, 90+360, 360.0/self.n)]
self.axes = [fig.add_axes(rect, projection="polar", label="axes%d" % i)
for i in range(self.n)]
self.ax = self.axes[0]
self.ax.set_thetagrids(self.angles, labels=titles, fontsize=12, weight="bold")
for ax in self.axes[1:]:
ax.patch.set_visible(False)
ax.grid("off")
ax.xaxis.set_visible(False)
for ax, angle, label …Run Code Online (Sandbox Code Playgroud) 我有一些RadarChart标签问题.具体来说,如果我使用长文本(例如15-20个字符),并且可用空间不是太大,则图表会折叠并且标签位于折叠图表内(但显然有更多可用空间).
我试图用ValueFormatter标签轴截断标签,如果长度超过5个字符,但正如我所见,图表大小计算基于完整标签文本,因为图表折叠方式与我之前描述的相同.
XAxis xAxis = radarChart.getXAxis();
xAxis.setValueFormatter(new XAxisValueFormatter() {
@Override
public String getXValue(String original, int index, ViewPortHandler viewPortHandler) {
return original.length() > 5 ? original.substring(0, 5) + "…" : original;
}
});
Run Code Online (Sandbox Code Playgroud)
这里有一些图片来澄清问题.图表显示在CardViews 内部,正如您所看到的,所有侧面都有足够的空间.前两张图片是用ValueFormatter套装拍的,后两张是没有它的.
所以我对此进行了很多研究,但还没有找到解决方案,我想更改雷达线的颜色,如下所示:
有没有办法做到这一点?
这是我当前的代码:
new Chart(document.getElementById("result_chart"), {
"type": "radar",
"data": {
"labels": ["Idea", "Timing", "Skills", "Concept", "Market Plan", "MVP", "Revenue Potential", "Competition", "Team", "BMC", "Financial Model"],
"datasets": [{
"label": "Your Results",
"data": [
10,
20,
30,
40,
50,
60,
70,
80,
90,
100,
110
],
"fill": true,
"backgroundColor": "rgba(165, 211, 164, 0.2)",
"borderColor": "rgb(165, 211, 164)",
"pointBackgroundColor": "rgb(165, 211, 164)",
"pointBorderColor": "#fff",
"pointHoverBackgroundColor": "#fff",
"pointHoverBorderColor": "rgb(255, 99, 132)"
}]
},
"options": {
"elements": {
"line": {
"tension": 0,
"borderWidth": 3
} …Run Code Online (Sandbox Code Playgroud) 我想在WinForms应用程序中使用MS Chart控件绘制雷达图表.
此图表包含1天的数据,我有每秒的数据,所以我有86 400 xy值对.X轴包含日期,y我的int值.
我的测试代码是这样的:
var fromDate = new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day,
0,
0,
0);
var toDate = new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day,
23,
59,
59);
List<DateTime> xValues = new List<DateTime>();
List<double> yValues = new List<double>();
var iterDate = fromDate;
var i = 0;
while (iterDate <= toDate)
{
xValues.Add(iterDate);
yValues.Add(i);
iterDate = iterDate.AddSeconds(1);
i++;
}
chart1.Series["Default"].Points.DataBindXY(xValues, yValues);
var dateLabelStyle = new LabelStyle();
dateLabelStyle.Format = "HH:mm:ss";
chart1.ChartAreas["Default"].AxisX.LabelStyle = dateLabelStyle;
chart1.ChartAreas["Default"].AxisX.Minimum = fromDate.ToOADate();
chart1.ChartAreas["Default"].AxisX.Maximum = toDate.ToOADate();
chart1.Series["Default"].IsXValueIndexed = true;
chart1.Series["Default"].ChartType = …Run Code Online (Sandbox Code Playgroud) 我的客户目前使用ASP.net应用程序,允许他根据30个问题进行用户调查并生成Excel报告.该过程耗时耗力,因为它包含5-6个步骤.
他想要一个可以生成报告的PHP解决方案,并且可以以PDF格式发送.
trciky部分是五角大楼图表/雷达图表 ..
Excel我猜有一组函数来生成这些图表,但我该如何使用PHP?
检查下面的URL ..
http://i.stack.imgur.com/Rpyiq.png
快速帮助高度赞赏!!!
有没有办法避免重叠 p 轴标签?已经看到其他人建议创建抖动,使用 direct.labels 等,但还没有找到一种方法来使该方法适用于radarchart{fmsb}
使用指向雷达图选项或其他函数的通用指针就可以了,但无论如何这里有一些可重现的代码:
library(fmsb)
MM<-data.frame(matrix(c(rep(1,35), rep(0,35),
runif(35, 0, 1), runif(35, 0, 1)), nrow=4, ncol=35, byrow=TRUE))
colnames(MM)<-rep('long variable name', 35)
colors_border=c( rgb(0,0,0,0.9), rgb(1,0,0,0.9))
colors_in=c( rgb(0,0,0,0.2), rgb(1,0,0,0.3))
radarchart(MM , axistype=1 ,
pcol=colors_border , pfcol=colors_in , plwd=2 , plty=1,
cglcol="grey", cglty=1, axislabcol="grey", cglwd=0.8,
caxislabels=c(0, 0.25, 0.5, 0.75, 1),
vlcex=0.8,
title='title',
na.itp=FALSE)
Run Code Online (Sandbox Code Playgroud)
(使文本更小有效,但这将是我的最后手段)。
我正在尝试使用显示我的数据radarchart {fmsb}.我的记录值变化很大.因此,在最终图中看不到低值.
是否每个记录都有"自由"轴,以便独立于其比例显示数据?
虚拟的例子:
df<-data.frame(n = c(100, 0,0.3,60,0.3),
j = c(100,0, 0.001, 70,7),
v = c(100,0, 0.001, 79, 3),
z = c(100,0, 0.001, 80, 99))
n j v z
1 100.0 100.0 100.000 100.000 # max
2 0.0 0.0 0.000 0.000 # min
3 0.3 0.001 0.001 0.001 # small values -> no visible on final chart!!
4 60.0 0.001 79.000 80.000
5 0.3 0.0 3.000 99.000
Run Code Online (Sandbox Code Playgroud)
创建雷达图
require(fmsb)
radarchart(df, axistype=0, pty=32, axislabcol="grey",# na.itp=FALSE,
seg = 5, centerzero …Run Code Online (Sandbox Code Playgroud) 为了便于重现,您可以在此处下载数据。它的结构是:
> str(data)
'data.frame': 30 obs. of 4 variables:
$ Count: num -15.26 NaN NaN -7.17 -49.37 ...
$ X1 : Factor w/ 1 level "Mean": 1 1 1 1 1 1 1 1 1 1 ...
$ X2 : Factor w/ 10 levels "DC1","DC10","DC2",..: 1 1 1 3 3 3 4 4 4 5 ...
$ X3 : Factor w/ 3 levels "SAPvsSH","SAPvsTD6",..: 1 2 3 1 2 3 1 2 3 1 ...
Run Code Online (Sandbox Code Playgroud)
我运行这个ggplot图表:
ggplot(data=data, aes(x=X2, …Run Code Online (Sandbox Code Playgroud) 我有雷达图。需要将网格从圆形更改为五边形。目前,我有这个输出:
而我期望这样的事情:
以下是有关我所拥有的系统的信息:Windows 10(64 位);Python - 3.8.0(32 位);matplotlib - 3.3.3。我在这里看到了这个问题:How to make a Polygon Radar (Spider) Chart in Python,但它没有解决我的问题。但这对我不起作用,我不明白为什么。我可以简单地复制代码,但结果是 - 外部边框更改为五边形形式,但内部网格线保持圆形。但这对其他人也有效!
程序代码如下:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, RegularPolygon
from matplotlib.path import Path
from matplotlib.projections.polar import PolarAxes
from matplotlib.projections import register_projection
from matplotlib.spines import Spine
from matplotlib.transforms import Affine2D
def radar_factory(num_vars, frame='circle'):
"""Create a radar chart with `num_vars` axes.
This function creates a RadarAxes projection and registers it.
Parameters
----------
num_vars : …Run Code Online (Sandbox Code Playgroud) radar-chart ×10
r ×3
javascript ×2
matplotlib ×2
android ×1
axis-labels ×1
c# ×1
chart.js ×1
d3.js ×1
ggplot2 ×1
graph ×1
gridlines ×1
html ×1
mschart ×1
pdf ×1
php ×1
python ×1
python-3.x ×1
survey ×1
winforms ×1