我正在使用nvd3绘制折线图,当我通过div nvd3
来绘制图表时,它给我这个错误
未捕获的TypeError:无法读取未定义的属性"createElementNS"
这是代码:
var chartDiv = 'line-chart'+ counter++;
tmpl = $($('#charts-panel-template').clone().html());
tmpl.find('.feature-line-chart').attr('id', chartDiv);
var div=tmpl.find('.feature-line-chart#'+chartDiv);
chartsPanel.append(tmpl);
nv.addGraph(function() {
var chart;
var width = 1024, height = 500;
chart = nv.models.lineChart()
// .color(sparkChart.colors)
.width(width).height(height);
//modify the x.axes
chart.x(function(d,i) {
return d.x;
});
//giving chart margin
chart.margin({right: 40});
$(div).empty();
//create chart
var svg = d3.select(div).append('svg')
.datum(data)
.transition()
.duration(500)
.call(chart)
.attr('width', width)
.attr('height', height);
Run Code Online (Sandbox Code Playgroud)
我的问题,
我似乎无法在画布上进行第二次剪辑调用。请参见小提琴:http : //jsfiddle.net/m2hL17nu/ 注意第一个径向渐变是如何裁剪的,而第二个则不是。
我见过HTML画布中可以有多个剪切区域吗?但是保存还原似乎仍然无法使下一个clip()工作。
在此先感谢您的帮助。参见下面的代码:
var x1 = 300,
y1 = 100,
x2 = 50,
y2 = 50,
r = 20;
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
function createRadialGradient (xa, ya, xb, yb, r) {
var grd = context.createRadialGradient(xa, ya, 0, xb, yb, r);
grd.addColorStop(0, 'rgba(0,0,0,1)');
grd.addColorStop(1, 'rgba(0,0,0,0)');
context.fillStyle = grd;
context.fill();
}
context.save();
context.rect(x1-r,y1-r,r,r);
context.clip();
context.rect(0, 0, canvas.width, canvas.height);
createRadialGradient(x1, y1, x1, y1, r);
context.restore();
context.save();
context.rect(x2-r,y2,r,r);
context.strokeStyle = 'black';
context.clip();
context.rect(0, 0, …
Run Code Online (Sandbox Code Playgroud) 我正在使用材料appcompatv7为工具栏和菜单抽屉做一个简单的代码.一切都在带有棒棒糖的Nexus 5上完美运行,但在前棒棒糖(4.1或4.4)设备崩溃时.问题在于定义风格.如果有人能告诉我故障在哪里,我会把我的代码.
这是我的主要活动:
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Hello extends ActionBarActivity {
private ActionBarDrawerToggle toggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hello);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
toggle = new ActionBarDrawerToggle(
this,
drawerLayout,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
toggle.setDrawerIndicatorEnabled(true);
drawerLayout.setDrawerListener(toggle);
ListView lv_navigation_drawer = (ListView) findViewById(R.id.lv_navigation_drawer);
lv_navigation_drawer.setAdapter(new ArrayAdapter<String>(
this,
android.R.layout.simple_list_item_1,
new String[] {"Screen 1", "Screen 2", "Screen 3"}));
}
@Override …
Run Code Online (Sandbox Code Playgroud) 在Bash中,使用T=content
在等号之前或之后没有空格的情况下为变量赋值.
尽管我在shell脚本PWD= /bin/pwd
中看到了以下内容,其中包含等号右侧的空格.
它有什么用途?
我想将文件上传到服务器的主目录(根目录),而不是文件夹.
我该怎么做?(使用C#)
transferResult = session.PutFiles(path, "\\", true, transferOptions);
Run Code Online (Sandbox Code Playgroud)
如果我使用\\
了remotePath
,上传的文件改名.
我正在编写和设计一个应用程序,我希望屏幕模式在打印模式下看起来相同.
以下是屏幕版本的屏幕截图:
这里是打印版本的屏幕截图(例如在Chrome上):
时间轴条纹设置为:before,不会打印.
有人有想法或解决方案吗?有人指导css打印规则吗?
我怎么能隐藏这个图标,
?
问题是我总是有相同的颜色背景,即使主题是黑色或浅,它看起来不好,我知道它可以隐藏它.在xaml但我不知道最好的方式!
我试过这个!但不工作:(
<Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PuzzleTalk"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
Shell:SystemTray.IsVisiable="False"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
Run Code Online (Sandbox Code Playgroud)
是否可以System.Type
从IntPtr
类型句柄中获取对象(可以通过获取)?Type.TypeHandle.Value
例:
TypeFromIntPtr(typeof(object).TypeHandle.Value) == typeof(object) //true
Run Code Online (Sandbox Code Playgroud)
编辑:我很高兴有许多有用的人认为我正在尝试解决其他问题,但我正在寻找这个特定问题的答案,我对此非常肯定.我很抱歉没有首先说明它.
编辑#2:类型句柄是一个指针,指向CLR中表示RTTI的结构.我不想从这个结构中读取数据,我想要一种为此返回托管Type
对象的方法.我需要将指针"转换"为对象.
我使用phpstorm和它的终端设施.
在终端部分我输入,F:\Projects\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -
所以它使用Cygwin作为终端.但它在主文件夹中打开它.是否可以在不同的文件夹中打开它?通过键入命令或通过执行其他操作.
因为我在这个文件夹中有一个名为F:\ Projects\Local的文件夹,我有流浪汉,我想打开phpstorm,在php风暴中打开终端,然后输入vagran.我不想再打开cgywin.
谢谢
我有一个像下面这样的选择菜单
<select name="scale" id="scale">
<option selected>linear</option>
<option>root</option>
<option>square</option>
</select>
Run Code Online (Sandbox Code Playgroud)
为了使它更好,我使用jQuery UI v1.11.2.
$('#scale').selectmenu();
Run Code Online (Sandbox Code Playgroud)
我现在可以读取下拉列表的值
alert($('#scale').val());
Run Code Online (Sandbox Code Playgroud)
这导致"线性"作为答案.我也可以通过使用将值设置为'square'
$('#scale').val('square');
alert($('#scale').val());
Run Code Online (Sandbox Code Playgroud)
这正确地给出了"方形"的答案.但是(!!!)下拉菜单不会在屏幕上显示.所以实际上我可以设置和读取值,但是可视化表示不会改变 - 小部件不会刷新.我在某个地方读了一个.change()
但没有任何影响.我也试过像jQuery UI中的答案,动态选择菜单值设置不会改变可见的选定值但是失败了.$('#scale').selectmenu('value', 'square');
错误消息中的任何重新启动Error: no such method 'value' for selectmenu widget instance
.
任何人都可以帮助如何在将窗口小部件设置为新值后刷新它?