小编sou*_*han的帖子

如何在 amcharts 中更改图表的背景颜色

    import React from 'react';
    import * as am4core from "@amcharts/amcharts4/core";
    import * as am4charts from "@amcharts/amcharts4/charts";
    import am4themes_animated from "@amcharts/amcharts4/themes/animated";

    am4core.useTheme(am4themes_animated);


    class Brand extends React.Component {

    componentDidMount() {
        am4core.useTheme(am4themes_animated);

    let chart = am4core.create("bubbleChart", am4charts.XYChart);


    let valueAxisX = chart.xAxes.push(new am4charts.ValueAxis());

    valueAxisX.renderer.ticks.template.disabled = true;
    valueAxisX.renderer.axisFills.template.disabled = true;

    let valueAxisY = chart.yAxes.push(new am4charts.ValueAxis());
    valueAxisY.renderer.ticks.template.disabled = true;
    valueAxisY.renderer.axisFills.template.disabled = true;

    let series = chart.series.push(new am4charts.LineSeries());

    series.dataFields.valueX = "x";
    series.dataFields.valueY = "y";
    series.dataFields.value = "value";
    series.strokeOpacity = 0;
    series.sequencedInterpolation = true;
    series.tooltip.pointerOrientation = "vertical";


    let …
Run Code Online (Sandbox Code Playgroud)

amcharts reactjs

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

如何禁用反应材料表中的某些特定列的编辑?

    import React from 'react';
    import MaterialTable from 'material-table';

    export default class DictionaryTable extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
        columns: [
            {title:'Need state',field: 'NeedState',lookup: { 1: 'Fragrance', 2: 'Price', 3:'Formulation',4:'Technolgy'} },
            { title: 'Keyword extracted', field: 'keyword' },
            { title: 'Actual Keyword', field: 'actual_keyword' },
            { title: 'Map score', field: 'map_score', type: 'numeric' },
            { title: '6 month mentions', field: 'six_month_mention'},
        ],
        data: [
            { NeedState: 1, keyword: 'mango', actual_keyword: 'apple', map_score: .3 ,six_month_mention:234},
            { NeedState: 2, keyword: …
Run Code Online (Sandbox Code Playgroud)

reactjs material-ui

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

使用链表实现 Javascript 队列

class Node {
    constructor(value){
        this.value = value;
        this.next = null;
    }
}


class Queue{
    constructor(){
        this.first = null;
        this.last = null;
        this.length = 0;
    }

    enqueue(value){
        const newNode = new Node(value)
        if(this.length === 0){
            this.first = newNode;
            this.last = newNode;
        } else {
            this.last.next = newNode;
            this.last = newNode;
        }
        this.length++;
        return this;
    }
}

const myQueue = new Queue();
myQueue.enqueue('a')
myQueue.enqueue('b')
Run Code Online (Sandbox Code Playgroud)

在这里,我正在使用链表实现Queue。在enqueue()方法的else 块中,我没有分配任何东西给 this.first我只分配给this.last

如果更改,我的this.first如何。

请看一看。

this.first是如何在不触及它的情况下发生变化的。

其实答案是正确的,但我无法理解其中的逻辑。

javascript

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

完成工作前的javascript函数日志记录

import html2canvas from 'html2canvas';

export default async function htmlToImg(id) {
  applyShadow(false);
  return await html2canvas(document.getElementById(id), {
      scale: 1
    })
    .then(canvas => {
      applyShadow(true);
      let img = canvas.toDataURL('image/png')
      console.log(img)
      return img
    });
}
Run Code Online (Sandbox Code Playgroud)

在这里我分享了我的代码。

我正在尝试将一些 html 节点转换为画布,然后将其转换为 i mage url。 但是,这是工作,但是,它给整个图像有时不同部分的50%,有时70%的的形象。html 很长,我认为它在完成将html 节点转换为 canvascanvas.toDataURL('image/png')之前正在打印

该函数是异步函数,因此它在完成转换完整的 html 之前记录日志。有什么办法可以解决吗?

请看一看

javascript reactjs

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

Javascript 防止函数调用

function alertOuter() {
  alert("outer alert")
}

function alertInner() {
  alert("inner alert")
  return
}
Run Code Online (Sandbox Code Playgroud)
<div onclick="alertOuter()" style="padding:20px;background:red;">
  <h1>Outer</h1>
  <br/>
  <button onclick="alertInner()">Inner</button>
</div>
Run Code Online (Sandbox Code Playgroud)

我对onclick事件有两个函数调用。

我想alertOuter在单击按钮时阻止功能。但是,当我单击按钮时,它正在调用这两个函数。

alertOuter当单击按钮只想调用alertInner()函数时,我想阻止该函数

我怎样才能做到这一点?

javascript

0
推荐指数
1
解决办法
43
查看次数

标签 统计

javascript ×3

reactjs ×3

amcharts ×1

material-ui ×1