小编tab*_*bim的帖子

Chart.js:直线而不是曲线

我正在使用Chart.JS绘制数据集,

但是我的效果很好!

这是我得到的曲线:

在此输入图像描述

这是我的代码:

function plotChart(data, labels) {

    var lineChartData = {
        "datasets": [{
            "data": data,
            "pointStrokeColor": "#fff",
            "fillColor": "rgba(220,220,220,0.5)",
            "pointColor": "rgba(220,220,220,1)",
            "strokeColor": "rgba(220,220,220,1)"
        }],
        "labels": labels
    };

    var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Line(lineChartData);

}
Run Code Online (Sandbox Code Playgroud)

我怎样才能有直线而不是曲线?

谢谢

chart.js

87
推荐指数
4
解决办法
5万
查看次数

不使用chart.js绘制空值

我正在使用Chart.js绘制图表.我的数据集有一些空值,实际上chart.js以这种方式在空值的前一个点和后一个点之间绘制一条线:

在此输入图像描述

红色箭头表示空值的位置

我想找到如何不绘制这些空值 在此输入图像描述

我使用的配置很简单:

var lineChartData = {
            "datasets": [{
                "label": "defi score",
                "data": data,
                "pointStrokeColor": "#fff",
                "fillColor": "rgba(220,220,220,0.5)",
                "pointColor": "rgba(220,220,220,1)",
                "strokeColor": "rgba(220,220,220,1)",
            }],
            "labels": labels
        };


        var ctx = document.getElementById("chart_per_week").getContext("2d");
        var myLine = new Chart(ctx).Line(lineChartData, {
            responsive: true,
            scaleFontColor: "#FF5972",
            bezierCurve: false
        });
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助

chart.js

11
推荐指数
3
解决办法
1万
查看次数

graphql的类型定义中的Date和Json

是否可以在我的graphql架构中将字段定义为Date或JSON?

type Individual {
    id: Int
    name: String
    birthDate: Date
    token: JSON
}
Run Code Online (Sandbox Code Playgroud)

实际上服务器正在给我一个错误说:

Type "Date" not found in document.
at ASTDefinitionBuilder._resolveType (****node_modules\graphql\utilities\buildASTSchema.js:134:11)
Run Code Online (Sandbox Code Playgroud)

和JSON一样的错误......

任何的想法 ?

apollo graphql

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

GraphQL:对象名称在解析器中定义,但不在架构中定义

我想用graphql定义一个变异.

我的变异是将对象作为参数.所以我使用GraphQLObjectType在模式和解析器中定义了新的Object.

但是我收到此错误:

错误:在解析程序中定义的Agreement.name,但在架构中没有

任何的想法 ?

这是我的架构定义

const typeDefs = `

    type Agreement {
        id: Int
    }

    type Mutation {
        agreementsPost(agreement: Agreement) : String
    }
`;
Run Code Online (Sandbox Code Playgroud)

这是我的解析器:

const appResolvers = {

    Agreement: new GraphQLObjectType({
        name: 'Agreement',
        fields: {
            id: { type: GraphQLInt },
        }
    }),
Mutation: {

       agreementsPost(root, args) {
            return axios.post("....").then(res => res.data);
        },
    }
Run Code Online (Sandbox Code Playgroud)

apollo graphql

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

组合包名称的命名约定

我想创建一个名为的包form validator.

写作更好吗?

  • form_validator,
  • formValidator 要么
  • formvalidator

我想提一下,我想避免 form.validator.那form-validator是被禁止的.

java naming-conventions package

9
推荐指数
4
解决办法
2158
查看次数

Openshift上Jenkins的用户名和密码

我通过Openshift redhat(https://openshift.redhat.com)安装了Jenkins .. Jenkins的安装完成了..

在此输入图像描述

要访问Jenkins的界面,我使用了我的Openshift帐户的用户名和密码,不幸的是它不起作用......

这是错误:

在此输入图像描述

我想提一下rhc的设置也在我的本地完成.任何的想法 ?谢谢

jenkins openshift

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

在没有的情况下在Guice中绑定

我有一个问题:通常在Guice中我使用bind(classe).to(another_class_Implementation)...

但是我在代码源中发现它们只使用了bind(class)(没有".to(another_class_Implementation)"部分)...

这是什么意思(bind(class)没有"to或as")?

以下是相关代码的一部分:

public class RestModule extends AbstractModule {

    @Override
    protected void configure() {

        bind(RootResource.class);
        bind(DeveloperUtilsRedirector.class);

        bind(M34Repository.class).to(M34RepositoryImpl.class);
        bind(IGARepository.class).to(IGARepositoryImpl.class);
Run Code Online (Sandbox Code Playgroud)

答案很感激

java guice

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

mappingBy 是指类名还是表名?

例如,当我们在@OneToMany 中使用mappedBy 注释时,我们是否提到了类名或表名?

一个例子:

@Entity
@Table(name = "customer_tab")
public class Customer {
   @Id @GeneratedValue public Integer getId() { return id; }
   public void setId(Integer id) { this.id = id; }
   private Integer id;

   @OneToMany(mappedBy="customer_tab")
   @OrderColumn(name="orders_index")
   public List<Order> getOrders() { return orders; }

}
Run Code Online (Sandbox Code Playgroud)

那么这两个哪个是正确的呢?:

  • @OneToMany(mappedBy="customer_tab")
  • @OneToMany(mappedBy="Customer") ?

谢谢!

java mapping hibernate jpa one-to-many

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

使用 Thymeleaf 和 Spring boot 以 JSON 格式发送表单

我正在使用 Thymeleaf 的表单将数据发送到我的服务。

这是我的表格:

<form th:object="${individualEntity}" th:action="@{/save}" method="post">
<div class="form-group">
    <label>FirstName:</label>
        <input type="text" class="form-control" th:field="*{individualName.givenName}"/>
</div>
<div class="form-group">
    <label>LastName:</label>
        <input type="text" class="form-control" th:field="*{individualName.surname}"/>
</div>
<div class="form-group">
    <label>Address:</label>
    <input type="text" th:field="*{address}"/>
</div>

<div class="row">
    <button type="submit">Submit</button>
</div>
Run Code Online (Sandbox Code Playgroud)

当我调试使用此表单发送的请求时,它会提供以下数据: individualName.givenName=xxxx&individualName.surname=xxxxx&address=xxxx

不过,我希望发送时采用 JSON 格式,因为我的微服务使用 JSON。

我应该怎么做才能纠正这个问题!

这是我的服务:

    @PostMapping(value = "save")
public String saveIndividual(Individual individual){
    individualService.saveIndividual(individual);
    return "redirect:/getIndividual/" + individual.getId();
}
Run Code Online (Sandbox Code Playgroud)

谢谢

thymeleaf spring-boot

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

openfeign 和 feign 之间的区别

有什么区别:

当我尝试使用 openfeign 遵循教程时发现了这个问题@FeignClient(name=...)。不过我用的是feign,不是openfeign,这个注解也不一样。

这不是同一件事吗?

spring-cloud-feign feign openfeign

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