Applies the plot parameters from the query to the given plot. @param query The query from which to get the query string. @param plot The plot on which to apply the parameters.
(final HttpQuery query, final Plot plot)
| 739 | * @param plot The plot on which to apply the parameters. |
| 740 | */ |
| 741 | static void setPlotParams(final HttpQuery query, final Plot plot) { |
| 742 | final HashMap<String, String> params = new HashMap<String, String>(); |
| 743 | final Map<String, List<String>> querystring = query.getQueryString(); |
| 744 | String value; |
| 745 | if ((value = popParam(querystring, "yrange")) != null) { |
| 746 | if (!RANGE_VALIDATOR.matcher(value).find()) { |
| 747 | throw new BadRequestException("'yrange' was invalid. " |
| 748 | + "Must be in the format [min:max]."); |
| 749 | } |
| 750 | params.put("yrange", value); |
| 751 | } |
| 752 | if ((value = popParam(querystring, "y2range")) != null) { |
| 753 | if (!RANGE_VALIDATOR.matcher(value).find()) { |
| 754 | throw new BadRequestException("'y2range' was invalid. " |
| 755 | + "Must be in the format [min:max]."); |
| 756 | } |
| 757 | params.put("y2range", value); |
| 758 | } |
| 759 | if ((value = popParam(querystring, "ylabel")) != null) { |
| 760 | if (!LABEL_VALIDATOR.matcher(value).find()) { |
| 761 | throw new BadRequestException("'ylabel' was invalid. Must " |
| 762 | + "satisfy the pattern " + LABEL_VALIDATOR.toString()); |
| 763 | } |
| 764 | params.put("ylabel", stringify(value)); |
| 765 | } |
| 766 | if ((value = popParam(querystring, "y2label")) != null) { |
| 767 | if (!LABEL_VALIDATOR.matcher(value).find()) { |
| 768 | throw new BadRequestException("'y2label' was invalid. Must " |
| 769 | + "satisfy the pattern " + LABEL_VALIDATOR.toString()); |
| 770 | } |
| 771 | params.put("y2label", stringify(value)); |
| 772 | } |
| 773 | if ((value = popParam(querystring, "yformat")) != null) { |
| 774 | if (!FORMAT_VALIDATOR.matcher(value).find()) { |
| 775 | throw new BadRequestException("'yformat' was invalid. Must " |
| 776 | + "satisfy the pattern " + FORMAT_VALIDATOR.toString()); |
| 777 | } |
| 778 | params.put("format y", stringify(value)); |
| 779 | } |
| 780 | if ((value = popParam(querystring, "y2format")) != null) { |
| 781 | if (!FORMAT_VALIDATOR.matcher(value).find()) { |
| 782 | throw new BadRequestException("'y2format' was invalid. Must " |
| 783 | + "satisfy the pattern " + FORMAT_VALIDATOR.toString()); |
| 784 | } |
| 785 | params.put("format y2", stringify(value)); |
| 786 | } |
| 787 | if ((value = popParam(querystring, "xformat")) != null) { |
| 788 | if (!FORMAT_VALIDATOR.matcher(value).find()) { |
| 789 | throw new BadRequestException("'xformat' was invalid. Must " |
| 790 | + "satisfy the pattern " + FORMAT_VALIDATOR.toString()); |
| 791 | } |
| 792 | params.put("format x", stringify(value)); |
| 793 | } |
| 794 | if ((value = popParam(querystring, "ylog")) != null) { |
| 795 | params.put("logscale y", ""); |
| 796 | } |
| 797 | if ((value = popParam(querystring, "y2log")) != null) { |
| 798 | params.put("logscale y2", ""); |