我正在使用这个库在我的网络应用程序中绘制图表.问题是我在y轴上有小数点.您可以在下图中看到
有没有办法可以限制它只有数字?
这是我的代码
var matches = $("#matches").get(0).getContext("2d");
var data = {
labels: labelsFromCurrentDateTillLastWeek,
datasets: [
{
label: "Last Weeks Matches",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: result
}
]
};
var options = {
scaleLabel: function (label) {
return Math.round(label.value);
}
};
var myLineChart = new Chart(matches, {
type: 'bar',
data: data,
options: options
})
Run Code Online (Sandbox Code Playgroud) 我制作了.net core 2.0网络应用程序.我使用NUGET添加了Entity Framework 6.2.0,然后我收到此错误
使用'.NETFramework,Version = v4.6.1'而不是项目目标框架'.NETCoreApp,Version = v2.0'恢复了包'EntityFramework 6.2.0'.此软件包可能与您的项目不完全兼容.
我该如何解决?
在我的c#代码中,我正在尝试创建一个zip文件夹供用户在浏览器中下载.所以这里的想法是用户点击下载按钮,他得到一个zip文件夹.
出于测试目的,我使用单个文件并压缩它,但是当它工作时,我将有多个文件.
这是我的代码
var outPutDirectory = AppDomain.CurrentDomain.BaseDirectory;
string logoimage = Path.Combine(outPutDirectory, "images\\error.png"); // I get the file to be zipped
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.BufferOutput = false;
HttpContext.Current.Response.ContentType = "application/zip";
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=pauls_chapel_audio.zip");
using (MemoryStream ms = new MemoryStream())
{
// create new ZIP archive within prepared MemoryStream
using (ZipArchive zip = new ZipArchive(ms))
{
zip.CreateEntry(logoimage);
// add some files to ZIP archive
ms.WriteTo(HttpContext.Current.Response.OutputStream);
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试这件事时,它给了我这个错误
中央目录损坏.
[System.IO.IOException] = {"试图在流的开头之前移动位置."}
异常发生在
使用(ZipArchive zip = new ZipArchive(ms))
有什么想法吗?
我正在使用Ember的Need Api来调用另一个控制器中的控制器方法.我能够获得控制器的实例,但是当我调用它时,它会返回给我这个错误 TypeError: Object [object Object] has no method.
这就是我所说的:
Cards.CardsIndexController = Ember.Controller.extend({
needs: 'account_info',
actions: {
accountInfoStart:function(){
console.log(this.get('controllers.account_info').test()); // error here
}
}
});
Run Code Online (Sandbox Code Playgroud)
这是我想要调用其功能的控制器
Cards.AccountInfoController = Ember.Controller.extend({
actions:{
test: function(){
alert(1);
}
}
});
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
我有一个任务.我有一个服务器调用来获取图像列表.除了其他信息,我还要添加这些天气从缓存或服务器加载的信息.
有没有办法可以检查api调用中的标题?如果它是来自缓存,我得到状态代码200,但我得到这样的额外信息(来自缓存).如果它不是来自缓存我只获得状态代码200.
我已经得到了答案已经给出或者它是重复的.我尝试过这个解决方案,似乎没有用.它也是特定于chrome的,我正在寻找一些应该适用于所有浏览器的更通用的东西.我希望这能解释为什么我没有采用那种解决方案.我在问这里之前已经搜过了它.
期待回应.
我有一些关于jQuery UI日期选择器的问题.
1 - 是否有选项可以使用默认值?我想要做的是用今天的日期预填充我的输入文本类型.
2 - 如果我把type ="Date"而不是type ="Text"然后使用jquery时间选择器,我选择日期时会出现此错误.
The specified value '02/18/2015' does not conform to the required format, 'yyyy-MM-dd.'
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
我正在尝试部署或删除甚至检查我部署的应用程序的日志
homlia-cc.meteor.com
但是我得到了这个错误
Error deploying application: Connection error (connect ETIMEDOUT).
Run Code Online (Sandbox Code Playgroud) 在我的应用中,我试图将图像转换为画布。我正在做的就是这个。
我正在尝试从外部服务器上载图像,当此操作完成时,如果图像的高度大于其宽度,则将其绘制在画布上并旋转它。
它在Chrome和FF中运行良好,但是在Safari中出现此错误
SECURITY_ERR:DOM异常18:试图突破用户代理的安全策略。
我不明白这是什么。有人可以让我知道吗?
所以我已经实现了压缩文件,但现在我有另一个问题,zip文件夹包含空文件.压缩文件的大小为0字节.
这就是我压缩文件的方式
try
{
var outPutDirectory = AppDomain.CurrentDomain.BaseDirectory;
string logoimage = Path.Combine(outPutDirectory, "images\\error.png");
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.BufferOutput = false;
HttpContext.Current.Response.ContentType = "application/zip";
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=pauls_chapel_audio.zip");
using (MemoryStream ms = new MemoryStream())
{
// create new ZIP archive within prepared MemoryStream
using (ZipArchive zip = new ZipArchive(ms, ZipArchiveMode.Create, true))
{
var demoFile = zip.CreateEntry(logoimage);
// add some files to ZIP archive
}
ms.WriteTo(HttpContext.Current.Response.OutputStream);
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
另一个问题是压缩文件夹的路径与图像的路径相同.所以它就像
ZippFolder/A/B/C/image...
Run Code Online (Sandbox Code Playgroud)
我只需要
ZipFolder/content
Run Code Online (Sandbox Code Playgroud) 我试图在.net core 2.0 Web应用程序中连接到localDB。我已经使用SQL Express创建了本地数据库。
我的appsettings.json看起来像这样
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "Data Source=(LocalDb)\\MSSQLLocalDB;Initial Catalog=Shopping;Integrated Security=True;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"
}
}
Run Code Online (Sandbox Code Playgroud)
我的上下文文件如下所示
public class ProductContext : DbContext
{
public ProductContext(DbContextOptions<ProductContext> options)
:base(options)
{
}
public DbSet<Product> Products { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我的启动文件通过这样的上下文
services.AddDbContext<ProductContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
Run Code Online (Sandbox Code Playgroud)
当我尝试从数据库中获取产品时
try
{
var d = await _context.Products.ToListAsync();
return View(d);
}
catch (Exception e)
{
}
Run Code Online (Sandbox Code Playgroud)
我抛出了这个异常
“无效的对象名称'Products'。”
我也在这里添加我的数据库映像
我假设它与数据库连接有关?
如何给文件提供路径?
c# ×4
javascript ×3
jquery ×2
asp.net ×1
caching ×1
canvas ×1
chart.js ×1
compression ×1
ember.js ×1
html5 ×1
jquery-ui ×1
meteor ×1
safari ×1
ziparchive ×1