Jump to content
Software FX Community

Using a line type chart with out-chart and varying the color of the line


Recommended Posts

PSH> gc chart.tmpCountry,ValueCanada,1Canada,10

PSH> import-csv chart.tmp|out-chart -values value -label country -palette highcontrast -series_0_gallery lines

The result is a solid green line to represent the line chart type.

 However, I'd like to know if I can vary the color of the line itself, depending on the value at that point, or even a gradual change in color of the line.

Link to comment
Share on other sites

What you are looking for is achieved using the ConditionalAttributes parameter. For example, the following line will color any point between 5 and 20 in Red:

import-csv chart.tmp|out-chart -values value -label country -palette highcontrast -series_0_gallery lines -ConditionalAttributes_0_Color Red -ConditionalAttributes_0_Condition_From 5 -ConditionalAttributes_0_Condition_To 20

Your sample will reflect better the condition if you use a bar chart instead of lines. since gradual changes are not supported. It will also show fine if you add another entry to your csv file, like: Canada, 15.

If you create several ConditionalAttributes it can become quite verbose. One option to overcome this is to use the Template Creator (using out-chart -config) 


Link to comment
Share on other sites

Another option would be to use our gradient fill mode instead of using conditional attributes, in this mode bar/area charts will use gradient from the "main color" (up) to the "alternate color" (down).

10,5,20,12,14,18,6 | out-chart -gallery area -AllSeries_FillMode gradient -palette highcontrast -Series_0_AlternateColor DarkBlue10,5,20,12,14,18,6 | out-chart -gallery area -AllSeries_FillMode gradient -palette highcontrast -Series_0_Color "#FF00FF00" -Series_0_AlternateColor "#2000FF00"

 Note that in the second sample we are specifying both the main and alternate color and using a semi transparent color for alternate.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...