code: @PUT
      @Produces(MediaType.APPLICATION_JSON)
      @Consumes(MediaType.APPLICATION_JSON)
      @Path("/{chartId}/preferences")
      @Description("Updates a chart preferences given the ID.")
      public ChartDto updateChartPreferences(@Context HttpServletRequest req, @PathParam("chartId") BigInteger chartId, final Map<String, String> preferences) {
  
          if (chartId == null || chartId.compareTo(BigInteger.ZERO) < 1) {
              throw new WebApplicationException("chartId cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
          }
  
          if (preferences == null) {
              throw new WebApplicationException("Cannot update with null preferences.", Status.BAD_REQUEST);
          }
  
          PrincipalUser remoteUser = getRemoteUser(req);
          Chart existingChart = _chartService.getChartByPrimaryKey(chartId);
          if (existingChart == null) {
              throw new WebApplicationException("Chart with ID: " + chartId + " does not exist. Please use a valid chartId.",
                      Response.Status.NOT_FOUND);
          }
          Dashboard sharedDashboard= _dService.findDashboardByPrimaryKey(existingChart.getEntity().getId());
          if (!sharedDashboard.isShared()) {
              _validateResourceAuthorization(remoteUser, existingChart.getOwner());
          }
  
          existingChart.getPreferences().putAll(preferences);
          existingChart.setModifiedBy(remoteUser);
          existingChart=_chartService.updateChart(existingChart);
          return ChartDto.transformToDto(existingChart);
      }
docs: Updates an existing chart preferences.
  
  @param   req             The HttpServlet request object. Cannot be null.
  @param   chartId         The id of a chart. Cannot be null.
  @param   preferences     Preferences for chart object. Cannot be null.
  
  @return  Updated chart object with preferences.
  
  @throws  WebApplicationException  An exception with 404 NOT_FOUND will be thrown if the chart does not exist.