小编iPh*_*Dev的帖子

Chartjs 高度不跟随父容器

注意:我已经修复了问题#2,这是错误的数据。我仍然面临问题#1。我有以下折线图配置。我的数据集示例数据是

{x: '29/01/2017', y: '0.00234'}

options: {
  responsive: true,
  maintainAspectRatio: false,
  scales: {
    xAxes: [{
      type: 'time',
      time: {
        format: 'DD/MM/YYYY'
      }
    }]
  }
}
Run Code Online (Sandbox Code Playgroud)

另外,我有 html (我使用 Angular Flex-layout)和打字稿:

<div fxFlex style="height: 100%">
    <div id="graph">
        <canvas id="canvasGraph">{{chart}}</canvas>
    </div>
</div>

// Hoping I can change the size of canvas to be the same as the parent
const canvas = <HTMLCanvasElement>document.getElementById('canvasGraph');
canvas.width = document.getElementById('graph').offsetWidth;
canvas.height = document.getElementById('graph').offsetHeight;
Run Code Online (Sandbox Code Playgroud)

我有 2 个(现在只剩下 1 个)问题:

  1. 最外面的div高度是100%。但由于某种原因,id="graph"的高度变成了150。而且画布也是150。我不知道这个150从哪里来。

  2. 然而,图表上的数据显示,它们都杂乱地分布在最右侧,我的 x 轴值是从 1973 年到 2016 年。但我的数据只有 2017 …

chart.js angular-flex-layout angular chartjs-2.6.0

7
推荐指数
1
解决办法
6072
查看次数

为什么sbt下载的scala版本与build.sbt中的版本不同?

build.sbt已经设置好了

scalaVersion := "2.11.7"
Run Code Online (Sandbox Code Playgroud)

但是,每当我运行build.sbt所在的sbt时,我总是会收到此错误

org.scala-lang#scala-library;2.10.5: configuration not found in
org.scala-lang#scala-library;2.10.5: 'master(compile)'. Missing
configuration: 'compile'. It was required from org.scalaz#scalaz-
effect_2.10;7.1.0 compile
Run Code Online (Sandbox Code Playgroud)

一开始,实际上它的版本是2.10.5

Getting Scala 2.10.5 (for sbt)...
Run Code Online (Sandbox Code Playgroud)

现在我无法继续.我在我的macbook中运行.

scala sbt

6
推荐指数
1
解决办法
1577
查看次数

使用最新版本的enigma.js图表

我在enigma.js和Vega上看到这个博客是可视化的.

https://community.qlik.com/blogs/qlikviewdesignblog/2017/03/17/creating-charts-with-enigmajs-and-vega

但是,此示例中使用的enigma.js版本不是最新版本.你知道在哪里可以找到使用最新版本的样本吗?我对enigma.js的文档有点困惑

qliksense

6
推荐指数
0
解决办法
108
查看次数

StaticInjectorError[e -&gt; e]: NullInjectorError: No provider for e

在我的 app.module.ts

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    MaterialModule,
    FlexLayoutModule,
    BrowserAnimationsModule,
    AppRoutingModule,
    HttpClientModule,
    FormsModule,
    ReactiveFormsModule,
    MyAppModule
  ],
  providers: [
    AuthenticationService,
    AuthGuardService,
    MyAppService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)

在我的 AuthGuardService 中:

@Injectable({
  providedIn: 'root'
})
export class AuthGuardService implements CanActivate {
Run Code Online (Sandbox Code Playgroud)

我已经在我的 authguard 中放置了 HttpClientModule,甚至添加了 providedIn,但我仍然遇到这个错误。我正在使用角度 7。

angular

6
推荐指数
1
解决办法
2376
查看次数

创建一些Object类型的Mockito数组

我需要提供一些这种类型的模拟对象数组"TypeA []".

我试图这样做但得到classcastexception:

List mockList = Mockito.anyListOf(TypeA.class);

when(someService.create(Mockito.any(TypeB.class), (TypeA[])mockList.toArray())).thenReturn(1);
Run Code Online (Sandbox Code Playgroud)

java junit junit4 mockito

5
推荐指数
1
解决办法
2万
查看次数

角树控制不突出整个细胞

我尝试从http://wix.github.io/angular-tree-control实现角树控制,但是,我无法突出显示整个单元格,它只是突出显示标签.我试图改变treecontrol附带的CSS,但我仍然不能突出整个单元格.

当前和预期的结果如下:

在此输入图像描述

treecontrol {
    font-family: Verdana, Helvetica, Arial, sans-serif;
    font-size:13px;
    color: #555;
    text-decoration: none;
}
treecontrol ul {
    margin: 0;
    padding: 0;
    list-style: none;
    border: none;
    overflow: hidden;
}
treecontrol li {
    position: relative;
    padding: 0 0 0 20px;
    line-height: 20px;
    ul {
      padding-left: 16px;
    }
    .tree-label {
      cursor: pointer;
      display: inline;
      &:focus {
        outline: none;
      }
      &:hover {
        outline: none;
        background-color: yellow;
      }
    }
    .tree-selected {
      background-color: yellow;
    }
    &.tree-expanded {
      > div {
        > .tree-icon-expand { …
Run Code Online (Sandbox Code Playgroud)

css css3 angularjs

5
推荐指数
1
解决办法
538
查看次数

将 Jupyterlab 嵌入到网站

我可以将 JupyterLab 嵌入到网站中吗?目前它会抛出框架祖先自身错误。是否可以更改某些配置以允许将其嵌入 iframe 中?

jupyter jupyter-notebook

5
推荐指数
1
解决办法
2094
查看次数

标头中有新行

如何在标题文本中添加新行?我尝试了以下解决方案,但这只是将文字自动换行。我需要做的是强迫新生产线

.ag-header-cell-label {
    text-overflow: clip;
    overflow: visible;
    white-space: normal;
}
Run Code Online (Sandbox Code Playgroud)

在我的html中,我添加了

[headerHeight]="48"
Run Code Online (Sandbox Code Playgroud)

在handsontable中,可以通过添加<br>标题文本来轻松完成此操作,但是在ag-grid中将无法使用。

ag-grid

5
推荐指数
2
解决办法
276
查看次数

react-slick 导致整个页面挂起

我为react-slick设置了以下配置:

infinite: true,
speed: 500,
slidesToShow: 6,
slidesToScroll: 5,
swipeToSlide: true,
autoplay: true,
arrows: false
dots: false
Run Code Online (Sandbox Code Playgroud)

每次滑动项目时,整个页面都会挂起。例如,除了这个浮华之外,我还有一张下表。当我尝试在光滑的滑动时滚动我的表格时,它会挂起,它会等待光滑的滑动完成,然后我才能滚动我的表格。打开模态窗口时也是如此。如果当我打开一个模态窗口时 slick 正在滑动,它会在显示我的模态窗口之前挂起,直到 slick 完成幻灯片。怎么解决这个挂的问题?

似乎即使只是使用 slick 本身也会导致页面在幻灯片滑动时挂起。

reactjs slick.js react-slick

5
推荐指数
1
解决办法
2087
查看次数

useRef 当前仅在第二次更新时获取其值

我有以下组件:

const ParentComponent: React.FC = () => {
    const networkRef: any = useRef();

    // Somewhere in the code, I call this
    networkRef.current.filter(["id0, id1, id2"]);

    return (
    ...
        <VisNetwork 
            ref={networkRef}
        />
    ...
    )
}
export default ParentComponent;

interface Props {
    ref: any;
}
const VisNetwork: React.FC<Props> = forwardRef((props: Props, ref) => {
    useImperativeHandle(ref, () => ({
        filter(items: any) {
            setFilterNodes(items);
            nView.refresh();
        }
    }));

    const [filterNodes, setFilterNodes] = useState<any[]>([]);
    const filterNodesRef = useRef(filterNodes);
    useEffect(() => {
        filterNodesRef.current = filterNodes;
    }, [filterNodes]);

    ... …
Run Code Online (Sandbox Code Playgroud)

javascript typescript reactjs visnetwork

5
推荐指数
1
解决办法
1997
查看次数