小编Eri*_*c G的帖子

Highcharts多个系列的自定义工具提示

我正在构建一个可以包含多达5种不同类型数据系列的高清图.我将类似的系列放在一起,因此不同的系列会有3个不同的y轴.

我遇到的问题是,我不能改变的工具提示为系列说的一个OnOff如果值为1000.

目前我使用的是共享工具提示,但每个数据系列都有自己的工具提示.5的4只使用前缀/后缀上工具提示,前%,amps,psig等.

不幸的是,我无法通过将工具提示更改为On或Off来使其工作.这是我尝试过的.

dataSeries.push({

    name: currData['name'],
    type: 'line', // Type of visual display
    width: 0.4,
    yAxis: currData['yAxis'],
    data: currData['series'],
    tooltip: {

        pointFormat: '{series.marker} {series.name}: ' + ('{value}' == 100 ? '<b>On</b><br />' : '<b>Off</b><br />')


        //valueSuffix: '{value}' === 100 ? 'On' : 'Off'

        formatter: function () {
            // Cant get any of these to work
            return '{value}' == 100 ? 'On' : 'Off';
            return this.y …
Run Code Online (Sandbox Code Playgroud)

javascript jquery highcharts

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

Java - 将字符串拆分为一个数组的更好方法

我只想要第一个元素s.split(","),我需要将值返回到String数组中.

如何将此代码设为一个班轮?

String [] sd = s.split(",");
String [] sf = new String[]{sd[0]};
Run Code Online (Sandbox Code Playgroud)

我试过s.split(",",1);但它只是将它全部添加到第一个元素而不实际拆分它.

java arrays string

3
推荐指数
2
解决办法
126
查看次数

使用行值的Postgres UPSERT UPdate

如果我的桌子是这样的

CREATE TABLE public.temperatures (
  temperature_io_id        integer NOT NULL,
  temperature_station_id   integer NOT NULL,
  temperature_value        double precision NOT NULL,
  temperature_current_kw  double precision NOT NULL,
  temperature_value_added  integer DEFAULT 1,
  temperature_kw_year_1   double precision DEFAULT 0,
  /* Keys */
  CONSTRAINT temperatures_pkey
    PRIMARY KEY (temperature_io_id, temperature_station_id, temperature_value)
) WITH (
    OIDS = FALSE
  );
Run Code Online (Sandbox Code Playgroud)

当存在io_id,station_id和温度的唯一组合时,我试图将值添加到表中。如果此组合已经存在,我想更新kw值并将1添加到value_added字段中。这将用于在该温度下保持kw的运行平均值。

INSERT INTO temperatures
(temperature_io_id, temperature_station_id, temperature_value, temperature_curr_kw)
VALUES
(20,30,40,10)
ON CONFLICT
(temperature_io_id, temperature_station_id, temperature_value)
DO UPDATE SET    
temperature_current_kwh = ((temperature_current_kw * temperature_value_added) + EXCLUDED.temperature_current_kw) / (temperature_value_added + 1),
                        temperature_value_added = …
Run Code Online (Sandbox Code Playgroud)

sql postgresql unique upsert

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

标签 统计

arrays ×1

highcharts ×1

java ×1

javascript ×1

jquery ×1

postgresql ×1

sql ×1

string ×1

unique ×1

upsert ×1