01 | { |
02 | enabled: true , |
03 | presets: { |
04 | enabled: false |
05 | } |
06 | } |
Presets Panel is a set of ranges, which for the user look as the buttons that change the selected dates range. AnyChart Stock supports several types of such ranges: by date time units and by the custom start and end dates.
By default Presets Panel is enabled, but you can disable it, if you want.
To disable the panel use this XML:
Live Sample with Presets Panel disabled:
By default there are several ranges in Presets Panel and if you need to add some or remove any - you need to rearrange it from the scratch.
The list of the ranges is set in <ranges> node, and each range in <range> node. Each <range> node is actually a button in presets panel.
Here is a sample XML with ranges defined:
Table below lists attributes of <range> node:
Attribute | Possible Values | Description |
---|---|---|
type | Unit YTD Max Custom |
Sets the range type of the button. |
unit | Year Semester Quarter Month ThirdOfMonth Week Day Hour Minute Second Millisecond | Sets the date/time unit. The required attribute for the "Unit" preset type. |
count | Any positive number greater than 0 | Sets the number of units defined by unit attribute that are represented by this range button. |
start_date | Any date/time value | Sets the custom start date for the preset button "Custom" type. This date should follow formatting rules described in Input Date-Time Format article. |
end_date | Any date/time value | Sets the custom end date for the preset button "Custom" type. This date should follow formatting rules described in Input Date-Time Format article. |
anchor | FirstDate FirstVisibleDate Center LastVisibleDate LastDate |
Sets an anchor for floating date time ranges. |
Also <range> node can contain two subnodes: <format> - where you can define the text of the button, and <button_settings> - where button is configured.
Sample XML with ranges of different type:
Live sample below shows different ranges and visual configuration of one of the buttons:
In Timescale and X-Axis Settings: Initial Visible Range you can find the description how to define the visible range.
If, for example, you'd like to see the last 5 months from the end of the chart and "5M" button to be selected in presets panel, you can simply set that range as usual (all range parameters should match), the corresponding range preset button will be selected automatically.
Here is a sample XML with the fourth range defined as selected:
Live sample below shows this. In presets year-to-day (YTD) button is selected. Note that all attributes, responsible for the range selection (for current range type) such as type, unit and count and anchor are equal for the range preset and the selected range:
You can configure how buttons look like - altogether or any button of your choice.
Each button has three states: normal, hover and selected. For each button you can define fill, border, corners shape, font and so on.
Sample XML of button visualization settings:
As you can see different fill is defined for different stats. Also, the spacing attribute of <button_settings> node defines spacing between the buttons.
In the same way you can modify one button:
Sample below shows modification of all buttons:
By default title of Presets Panel shows text: "Zoom:". You can disable this text or change it and its settings.
Sample XML for title configuration:
Live sample shows this setting at work: