Profile Picture

Create a Linear Gauge with multiple gradients

Posted By Vahid Mesri 6 Years Ago

Create a Linear Gauge with multiple gradients

Author
Message
Vahid Mesri
Question Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 11, Visits: 67
Hi,
I would like to create a linear gauge with its background colour set based on 3 thresholds as shown in the below image.
There colour changes should use gradients as oppose to sudden changes to the colour.
There are two pointers in the plot, one has a diamond shape and the other one is a dashed line.


I've tried to replicate the plot using Nevron gauges (see the image below) but so far I have had issues setting the width of the gauge or setting multiple gradients at a precise cut-off point. To increase the width I've added extra axes but I cannot replicate the gradients as the maximum allowed gradient uses 2 colours and I couldn't give the precise value for the start and end point for the colours.
73% of original size (was 688x19) - Click to enlarge
https://www.nevron.com/forum/uploads/images/21036f16-c6b9-41a6-9542-24ef.png


Could you please tell me how such a plot/gauge can be replicated in Nevron?
Should I use a Gauge or a Nevron chart? 

Thanks a lot in advance.



Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,018

Hi Vahid,
You need to use the chart control for this purpose as indeed the gauge only supports two colors per gradient. To replicate the attached picture you can use a bar series with one bar (bar width percent should be set to 100%) and then use the following custom code:

using System;
using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;

namespace MyNamespace
{
 /// <summary>
 /// Sample class
 /// </summary>
 public class MyClass
 {
  /// <summary>
  /// Main entry point
  /// </summary>
  /// <param name="context"></param>
  public static void RSMain(NRSChartCodeContext context)
  {
   NChart chart = context.document.Charts[0];
   NBarSeries bar = (NBarSeries)chart.Series[0];
   
   bar.Palette = new NPalette();
   bar.Palette.SmoothPalette = true;
   bar.Palette.Mode = PaletteMode.Custom;
   bar.Palette.Add(0, Color.Red);
   bar.Palette.Add(0.5, Color.Green);
   bar.Palette.Add(1.0, Color.Blue);
  }
 }
}
It shows how to apply a 3 color gradient to a bar series. Hope this helps - let us know if you meet any problems or have any questions.



Best Regards,
Nevron Support Team



Vahid Mesri
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 11, Visits: 67
Hi,
Thanks a lot for the solution.
It did work indeed on my local PC with the most recent version of Nevron in which the NBarSeries has the Palette property.
Unfortunately on our server, we do not have the latest version of Nevron (it is Nevron Vision 2012) hence the report doesn't get rendered.
Is there any way we could have this functionality on prior versions or do we have to upgrade?

Cheers!




Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,018
Hi Vahid,
You'll have to update the version on the server with the most recent release as 2012 indeed does not support the Palette option (it was added in later versions). Let us know if you have any questions.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic

1 active, 1 guest, 0 members, 0 anonymous.
No members currently viewing this topic!