首页 \ 问答 \ 基于从Highstock中的rangeSelector中选择的范围的自定义滴答(custom ticks based on selected range from rangeSelector in Highstock)

基于从Highstock中的rangeSelector中选择的范围的自定义滴答(custom ticks based on selected range from rangeSelector in Highstock)

我试图让我的Highcharts / Highstock图表在rangeSelector设置为All时显示自定义打勾,我以这种方式设置了它,但是当我尝试使用图形的交互式部分时抛出错误

在范围选择器更改下收到低于Highstock Change滴答间隔的答案

  componentDidMount() {
    // Timezone Offset for PST standard is UTC timezone
    Highcharts.setOptions({
        global: {
          timezoneOffset: 8 * 60
        },
        lang: {
          thousandsSep: ','
        }
    });
    Highcharts.stockChart('chart', {
      chart: {
          backgroundColor:'rgba(255, 255, 255, 0.0)',
          height: 400,
          zoomType: 'xy'
      },

      title: {
          text: 'Bitcoin Chart',
          style: {
            color: 'white'
          }
      },

      navigator: {
        trigger: "navigator",
        triggerOp: "navigator-drag",
        rangeSelectorButton: undefined,
        handles: {
          backgroundColor: 'white',
          borderColor: 'black'
        }
      },

      scrollbar: {
        enabled: false
      },

      rangeSelector: {
        buttons: [{
            type: 'day',
            count: 1,
            text: '1d'
        }, {
            type: 'day',
            count: 7,
            text: '7d'
        }, {
            type: 'month',
            count: 1,
            text: '1m'
        }, {
            type: 'month',
            count: 3,
            text: '3m'
        }, {
            type: 'year',
            count: 1,
            text: '1y'
        }, {
            type: 'all',
            text: 'All'
        }],
          selected: 6,
          // styles for the buttons
          buttonTheme: {
            fill: 'black',
            // stroke: 'none',
            'stroke-width': 0,
            r: 8,
            style: {
                color: 'white',
                fontWeight: 'bold'
            },
            states: {
                hover: {
                },
                select: {
                    fill: 'white',
                    style: {
                        color: 'black'
                    }
                }
            }
          },
          // Date Selector box
          inputBoxBorderColor: 'black',
          inputBoxWidth: 120,
          inputBoxHeight: 18,
          inputStyle: {
              color: 'black',
              fontWeight: 'bold'
          },
          labelStyle: {
              color: 'silver',
              fontWeight: 'bold'
          },
      },

      series: [{
          name: 'Bitcoin Price',
          color: 'black',
          data: this.props.data.all_price_values,
          type: 'area',
          threshold: null,
          tooltip: {
            valuePrefix: '$',
            valueSuffix: ' USD',
            valueDecimals: 2
          }
      }],

      plotOptions: {
          series: {
              fillColor: {
                  linearGradient: [0, 0, 0, 0],
                  stops: [
                      [0, '#FF9900'],
                      [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
                  ]
              }
          }
      },

      xAxis: {
        events: {
          setExtremes: function(e) {
            if (e.trigger === "rangeSelectorButton" && e.rangeSelectorButton.text === "All") {
              var range = e.max - e.min;

              // ticks spaced by one day or one hour
              var ticksSpacing = range >= 86400 * 1000 ? 86400 : 3600;

              this.update({
                  tickPositioner: function() {
                      var positions = [],
                      info = this.tickPositions.info;
                      for (var x = this.dataMin; x <= this.dataMax; x += ticksSpacing * 1000) { // Seconds * 1000 for ticks
                          positions.push(x);
                      };
                      positions.info = info;
                      return positions;
                  }
              }, false);
            }
          }
        },
        title: {
          enabled: true,
          text: 'Date (Timezone: PST)',
          style: {
            color: 'white'
          }
        },
        labels: {
          style: {
            color: 'white'
          }
        },
        type: 'datetime',
        dateTimeLabelFormats: {
            day: '%b %e, %Y'
        },
        tickInterval: 1
      },

      yAxis: {
        floor: 0,
        labels: {
          formatter: function () {
                    return '$' + this.axis.defaultLabelFormatter.call(this);
            },
          format: '{value:,.0f}',
          align: 'left',
          style: {
            color: 'white'
          },
        },
      },
      // Mobile Design
      responsive: {
          rules: [{
              condition: {
                  maxWidth: 600
              },
              chartOptions: {
                  chart: {
                      height: 400
                  },
                  subtitle: {
                      text: null
                  },
                  navigator: {
                      enabled: false
                  }
              }
          }]
      }
    });
  }

在这里输入图像描述

我在谈论蓝色突出显示的部分,当我移动它时,它会引发错误 在这里输入图像描述

我试图让图表每天在所有rangeSelector上有2个图,显示当天的第一个点和一天中的最后一个点。 我究竟做错了什么?

编辑1:更新为完整配置,X轴现在被原始答案打乱,自定义范围选择器上的刻度仍在工作。 添加图像以显示正在发生的事情

在这里输入图像描述

在这里输入图像描述


I am trying to get my Highcharts/Highstock chart to display a custom tick when the rangeSelector is set to All, I have it setup this way, but is throwing me errors when I try to use the interactive portion of the graph

Received below answer from Highstock Change tick interval on range selector change

  componentDidMount() {
    // Timezone Offset for PST standard is UTC timezone
    Highcharts.setOptions({
        global: {
          timezoneOffset: 8 * 60
        },
        lang: {
          thousandsSep: ','
        }
    });
    Highcharts.stockChart('chart', {
      chart: {
          backgroundColor:'rgba(255, 255, 255, 0.0)',
          height: 400,
          zoomType: 'xy'
      },

      title: {
          text: 'Bitcoin Chart',
          style: {
            color: 'white'
          }
      },

      navigator: {
        trigger: "navigator",
        triggerOp: "navigator-drag",
        rangeSelectorButton: undefined,
        handles: {
          backgroundColor: 'white',
          borderColor: 'black'
        }
      },

      scrollbar: {
        enabled: false
      },

      rangeSelector: {
        buttons: [{
            type: 'day',
            count: 1,
            text: '1d'
        }, {
            type: 'day',
            count: 7,
            text: '7d'
        }, {
            type: 'month',
            count: 1,
            text: '1m'
        }, {
            type: 'month',
            count: 3,
            text: '3m'
        }, {
            type: 'year',
            count: 1,
            text: '1y'
        }, {
            type: 'all',
            text: 'All'
        }],
          selected: 6,
          // styles for the buttons
          buttonTheme: {
            fill: 'black',
            // stroke: 'none',
            'stroke-width': 0,
            r: 8,
            style: {
                color: 'white',
                fontWeight: 'bold'
            },
            states: {
                hover: {
                },
                select: {
                    fill: 'white',
                    style: {
                        color: 'black'
                    }
                }
            }
          },
          // Date Selector box
          inputBoxBorderColor: 'black',
          inputBoxWidth: 120,
          inputBoxHeight: 18,
          inputStyle: {
              color: 'black',
              fontWeight: 'bold'
          },
          labelStyle: {
              color: 'silver',
              fontWeight: 'bold'
          },
      },

      series: [{
          name: 'Bitcoin Price',
          color: 'black',
          data: this.props.data.all_price_values,
          type: 'area',
          threshold: null,
          tooltip: {
            valuePrefix: '$',
            valueSuffix: ' USD',
            valueDecimals: 2
          }
      }],

      plotOptions: {
          series: {
              fillColor: {
                  linearGradient: [0, 0, 0, 0],
                  stops: [
                      [0, '#FF9900'],
                      [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
                  ]
              }
          }
      },

      xAxis: {
        events: {
          setExtremes: function(e) {
            if (e.trigger === "rangeSelectorButton" && e.rangeSelectorButton.text === "All") {
              var range = e.max - e.min;

              // ticks spaced by one day or one hour
              var ticksSpacing = range >= 86400 * 1000 ? 86400 : 3600;

              this.update({
                  tickPositioner: function() {
                      var positions = [],
                      info = this.tickPositions.info;
                      for (var x = this.dataMin; x <= this.dataMax; x += ticksSpacing * 1000) { // Seconds * 1000 for ticks
                          positions.push(x);
                      };
                      positions.info = info;
                      return positions;
                  }
              }, false);
            }
          }
        },
        title: {
          enabled: true,
          text: 'Date (Timezone: PST)',
          style: {
            color: 'white'
          }
        },
        labels: {
          style: {
            color: 'white'
          }
        },
        type: 'datetime',
        dateTimeLabelFormats: {
            day: '%b %e, %Y'
        },
        tickInterval: 1
      },

      yAxis: {
        floor: 0,
        labels: {
          formatter: function () {
                    return '$' + this.axis.defaultLabelFormatter.call(this);
            },
          format: '{value:,.0f}',
          align: 'left',
          style: {
            color: 'white'
          },
        },
      },
      // Mobile Design
      responsive: {
          rules: [{
              condition: {
                  maxWidth: 600
              },
              chartOptions: {
                  chart: {
                      height: 400
                  },
                  subtitle: {
                      text: null
                  },
                  navigator: {
                      enabled: false
                  }
              }
          }]
      }
    });
  }

enter image description here

I am talking about the blue highlighted section, when I move it, it throws an error enter image description here

I am trying to get the charts to have 2 plots per day on ALL rangeSelector, displaying the first point in the day and the last point in a day. What am I doing wrong?

EDIT 1 : Updated to full config, X Axis is now being disrupted by the original answer, ticks on custom range selector is still in works. Added images to show what's going on

enter image description here

enter image description here


原文:https://stackoverflow.com/questions/49188433
更新时间:2024-01-25 07:01

最满意答案

不幸的是,这目前还不可行。 但您可以随时在我们的问题跟踪器中请求此类功能,您可以在http://developers.google.com/+/support上找到该功能。

我还建议阅读上面评论中链接的问题,因为它确实提供了有关更一般用例的信息。


Unfortunately, this is not currently possible. But you can always request a feature like this in our Issue Tracker, which you can find at http://developers.google.com/+/support.

I also recommend reading the question linked in the comment above, as it does provide information about a more general use-case.

相关问答

更多
  • 收到数据意图后,您应该使用contentResolver获取照片。 以下是你应该做的事情: String url = intent.getData().toString(); Bitmap bitmap = null; InputStream is = null; if (url.startsWith("content://com.google.android.apps.photos.content")){ is = getContentResolver().openInputStream(U ...
  • 这是一个旧的! Priyanka - 没有办法转到应用程序 ,但有一个使用浏览器的iOS共享库,但为您提供了大量的控制:developers.google.com/+/mobile/ios/share 看一看: - (IBAction) didTapShare: (id)sender { id shareBuilder = [[GPPShare sharedInstance] shareDialog]; // This line will fill out the ...
  • 嗯,Google+没有“墙”,它有“流”。 适当的术语可能会帮助您找到更好的搜索结果。 无论哪种方式,除非您是Google合作伙伴,否则消息不是很好: API目前仅限于只读访问。 从API网站 : 注意:Google+ API目前提供对公开资料的只读访问权限。 所有API调用都需要OAuth 2.0令牌或API密钥 。 因为它是只读的,您将无法通过API更新或发布任何信息 - 您只能使用它来提取基本信息,如个人资料和活动详细信息。 鉴于对API的访问可能会随着时间的推移而改变,我将尝试将此答案更新为有关新闻 ...
  • 您可以尝试将文件保存到外部缓存,它对我有用。 Glide示例: Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.setType("image/*"); Glide.with(getContext()) .load("http://...url.here...") .asBitmap() .into(new SimpleTarget
  • 不幸的是,这目前还不可行。 但您可以随时在我们的问题跟踪器中请求此类功能,您可以在http://developers.google.com/+/support上找到该功能。 我还建议阅读上面评论中链接的问题,因为它确实提供了有关更一般用例的信息。 Unfortunately, this is not currently possible. But you can always request a feature like this in our Issue Tracker, which you can fi ...
  • Share API旨在共享页面,但您可以共享页面并使该页面上的Snippet数据包含您要共享的文本。 您可能还需要查看当前处于开发人员预览状态的历史记录API ,以查看它是否符合您的需求,或向Google提供有关您可能需要的更改的反馈。 The Share API is intended for sharing pages, although you could share a page and have the Snippet data on that page contain the text that ...
  • 你有几个不同的选择,但我不确定它们中的任何一个是你真正想要的。 Google+并不真正允许外部应用自动上传和分享内容。 正如您所观察到的,您可以获得的最接近的是为他们分享的时刻。 虽然与“即时上传”有相似之处,但它并不完全相同。 您可以使用数据网址来编码和存储图像作为当下的一部分,但我还没有对此进行测试。 另一种方法是使用Google Drive API将图片存储在其云端硬盘空间中,允许公开阅读图片,获取图片链接,并将此链接用作缩略图网址。 同样,您也许可以使用Picasa网络相册数据API来存储图像。 两 ...
  • GPPSignIn类使用Google为用户签名。 它通过Google+应用(如果已安装),Chrome for iOS(如果已安装)或Mobile Safari提供单点登录。 有关参考,请参阅https://developers.google.com/+/mobile/ios/sign-in上的 “Google+登录iOS”。 以下是使用GPPSignIn的示例代码: Get a reference to the GPPSignIn shared instance: GPPSignIn *signIn = ...
  • 问题解决了。 这个问题与WebView无关。 我的Android浏览器使用一个帐户登录Google,而WebView使用另一个帐户。 D'哦。 WebView适用于它使用的帐户。 Problem solved. The issue had nothing to do with WebView. My Android browser was logged into Google using one account, and WebView was using another. D'oh. WebView wo ...
  • 要在iOS中与Google+分享,您必须使用Google提供的用户界面 。 例外情况是,您的所有用户都是Google Apps for Business客户。 To share to Google+ in iOS you will have to use the Google provided UI. The exception is if all of your users are Google Apps for Business customers.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)