I am using a scatterchart with connect with lines property enabled. I'm trying to match the color of the line with the associated treeview item so i need to grab the color from the scatterchart line. It is set to pure random right now. I am also using series and adding each series to the ultrachart in case that matters.
this->ucLineChart->ColorModel->ModelStyle = Infragistics::UltraChart::Shared::Styles::ColorModels::PureRandom;
To recap:
I have a System::color variable that just needs to grab the correct color from a scatter chart set with pure random for the color model.
Thanks!
I ended up finding a very easy solution. Inside my main form load event i have the following:
this->ucLineChart->ColorModel->CustomPalette = gcnew cli::array<Color> {Color::Red, Color::Orange, Color::Yellow, Color::Green,Color::Blue, Color::Indigo, Color::Violet};
this->ucLineChart->ColorModel->ModelStyle = Infragistics::UltraChart::Shared::Styles::ColorModels::CustomLinear;
Then I add the the lines one by one using each series and after each load of a series, i grab the color like so:
color = this->ucLineChart->ColorModel->CustomPalette[(ucLineChart->Series->Count - 1) % 7];
Does anyone know how to do this? Thanks.
Is there anyway from this event to get the series Index? So i know which line it is? Thanks!
Hi,
Try using the ChartDrawItem event for the current line:
protected void Page_Load(object sender, EventArgs e){ ............................. UltraChart1.ChartDrawItem += new Infragistics.UltraChart.Shared.Events.ChartDrawItemEventHandler(UltraChart1_ChartDrawItem); UltraChart1.DataSource = DemoTable.Table(3); UltraChart1.DataBind();}void UltraChart1_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e){ if (e.HasData) { if (e.Primitive is Polyline) { //e.Primitive.PE.Fill gives the color of the current line } }}