Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
Get Color of New Line
posted

Let me explain what I am doing, I have two WinCharts (LineCharts) and a datagrid. The 1st chart and datagrid are bound to one datatable and the other chart is bound to a second datatable. The second datatable is generated dynamically. When the user clicks a line in the first UltraChart, I add a column to the 2nd datatable with that information. I want to get the color of the new line and color the cells in the DataGrid to match. Is there an easy way to get the color of the new line when it is created? The only way I have been able to figure out is to loop through the primitives on the UltraChart and get the last Polyline. But that is kind of heavy handed considering this is used for real-time analysis. Thanks!

  • 28496
    Offline posted

     If you are using the Series collection as a DataSource, you can just add a PaintElement to the PEs collection of the series you are adding. 

    Otherwise, you could just set the ColorModel.ModelStyle to CustomLinear and update the ColorModel.CustomPalette to an array of colors of equal length to the # of lines displayed.

    Or, you could add an Override to the Overrides collection and set the color using the Row # of the line you're adding.

    finally, the ChartDrawItem is a bit less heavy-handed than FillSceneGraph or a custom layer, if you want to just catch your Polyline before rendering and change the color then.