Profile Picture

multiple bar colors

Posted By Hong Tran 5 Months Ago
Author
Message
Hong Tran
Posted 5 Months Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 5 Months Ago
Posts: 1, Visits: 2
OLD Chart:
This is a chart that works correctly in Nevron chart.

 
NEW Charts
 Today we have a new requirement to update the chart with "Your Performance" - X axis to a number of bars with different colors as shown. 

  
Would you please confirm is this requirement doable?  How would I solve/update the chart?  Thank you in advance.
Hong Tran
  


Nevron Support Team
Posted 4 Months Ago
View Quick Profile
Supreme Being

Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)

Group: Moderators
Last Active: 1 days ago @ 8:33 AM
Posts: 2,593, Visits: 2,279
Hi Hong,
Yes this requirement is doable - you need to do the following:
1. Go to Chart \ Chart Areas \ Chart Area 0 \ Appearance.
2. Select Color Mode = DataPoint.
at this point the chart palette will be applied per data point (not per series) and the bar clusters will have different color. Then you need to modify the color of the second bar with custom code. To do this select the code tab and paste the following 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 = chart.Series[1] as NBarSeries;
   bar.FillStyles.Clear();
   bar.BorderStyles.Clear();
   
   bar.BorderStyle = new NStrokeStyle(0, Color.Gray);
   bar.FillStyle = new NColorFillStyle(Color.Gray);
  }
 }
}

This code overrides the fill / border styles applied on data points from the designer and specifies another color for the bars (in this case Color.Gray).
Hope this helps - let us know if you have any questions or meet any problems.



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic