TeeChart skinning

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #37585
    DrJester
    Participant

    Is there any way to apply skins to TeeChart or at least to color it in accordance with the selected skin?

    I would appreciate any help or hints with this matter.

    #57038
    Support
    Keymaster

    Hello!

    Look this demo, I hope it helps: http://www.alphaskins.com/sfiles/demos/chartbg.zip

    Please, write me if you have any questions, I will be glad to help.

    #57047
    DrJester
    Participant
    'Support' wrote:

    Hello!

    Look this demo, I hope it helps: http://www.alphaskins.com/sfiles/demos/chartbg.zip

    Please, write me if you have any questions, I will be glad to help.

    Thanks a lot! This demo implements the effect of a transparent background, which makes it appear to be skinned.

    However, the main problem is readability of the Chart content under different skins. What would really help is something like that:

    Chart.Color := Skin.Edit.BackgroundColor;

    Chart.Font.Color := Skin.Edit.ForegroundColor;

    Unfortunately, I've failed to find neither proper sources for these colors in the skin data, nor assigning colors on chart result in its proper functionality (somehow it stops redraw its content).

    By the way, is there any particular reason why TeeChart is not supported by AlphaSkins “off-the-shelf”, as a third party component?

    #57051
    Support
    Keymaster

    Hello!

    You can receive a color of parent control also, using this code:

    Code:
    uses sVCLUtils;

    c := GetControlColor(Chart.Parent);Try it please, and write me if you need another solution.
    #57052
    DrJester
    Participant
    'Support' wrote:

    Hello!

    You can receive a color of parent control also, using this code:uses sVCLUtils;

    c := GetControlColor(Chart.Parent);Try it please, and write me if you need another solution.

    This (along with GetControlFontColor ) helped to get the colors, thanks!

    Although coloring is explicit at run-time, it is still better than to have it white in all skins.

    I understand that support of TeeChart is not a well-defined problem due to the huge amount of different colors.

    However, it would be good to have more than two colors, that look nice together.

    For example, in order to color TeeChart myself, I would need at least three colors: background (GetControlColor), contrast foreground (GetControlFontColor) to show easily readable text), and some less contrast color for axes, grids, and ticks. Some highlighted background would be also nice to have.

    What I am talking about, is some kind of color scheme provided by the skin. Is there such a scheme available in the current version?

    #57053
    TAZ
    Participant

    Using what Serge suggested here is something that should help. Add it to the UpdateChartBackImage in the demo he mentioned.

    Chart.LeftAxis.Title.Font.Color := GetControlColor(Chart.Parent);

    Chart.BottomAxis.Title.Font.Color := GetControlColor(Chart.Parent);

    Chart.LeftAxis.LabelsFont.Color := GetControlColor(Chart.Parent);

    Chart.BottomAxis.LabelsFont.Color := GetControlColor(Chart.Parent);

    Chart.Title.Font.Color := GetControlColor(Chart.Parent);

    If you use top and/or right axis, just add them too.

    Also I have done this a little differently than the demo and it works perfectly. (smMain is SkinManager)

    procedure TfrmMain.UpdateChartBackImage(Chart: TChart);

    begin

    Chart.Color := smMain.GetGlobalColor;

    Chart.LeftAxis.Title.Font.Color := smMain.GetGlobalFontColor;

    Chart.BottomAxis.Title.Font.Color := smMain.GetGlobalFontColor;

    Chart.LeftAxis.LabelsFont.Color := smMain.GetGlobalFontColor;

    Chart.BottomAxis.LabelsFont.Color := smMain.GetGlobalFontColor;

    end;

    Either way should help.

    #57054
    DrJester
    Participant
    'TAZ' wrote:

    Using what Serge suggested here is something that should help. Add it to the UpdateChartBackImage in the demo he mentioned.

    Chart.LeftAxis.Title.Font.Color := GetControlColor(Chart.Parent);

    Chart.BottomAxis.Title.Font.Color := GetControlColor(Chart.Parent);

    Chart.LeftAxis.LabelsFont.Color := GetControlColor(Chart.Parent);

    Chart.BottomAxis.LabelsFont.Color := GetControlColor(Chart.Parent);

    Chart.Title.Font.Color := GetControlColor(Chart.Parent);

    If you use top and/or right axis, just add them too.

    Also I have done this a little differently than the demo and it works perfectly. (smMain is SkinManager)

    procedure TfrmMain.UpdateChartBackImage(Chart: TChart);

    begin

    Chart.Color := smMain.GetGlobalColor;

    Chart.LeftAxis.Title.Font.Color := smMain.GetGlobalFontColor;

    Chart.BottomAxis.Title.Font.Color := smMain.GetGlobalFontColor;

    Chart.LeftAxis.LabelsFont.Color := smMain.GetGlobalFontColor;

    Chart.BottomAxis.LabelsFont.Color := smMain.GetGlobalFontColor;

    end;

    Either way should help.

    Thanks a lot for your help! This is how did it, but still, it would be nice to have more than two skin defined colors that look nice together.

    #57055
    TAZ
    Participant

    Experiment. Take GetGlobalFontColor and divide or multiply it by 2 or whatever. Anything is possible.

    Also look under: http://www.alphaskins.com/afaq.php Serge has some neat tips.

    #57056
    Support
    Keymaster

    Hello!

    Also, you can use this function: GetControlFontColor.

    Some colors of the current skin may be found in the SkinManager.Palette array.

    Example:

    Code:
    FocusedSelectionColor := SkinManager.Palette[pcSelectionBG_Focused];

    The list of possible array indexes:

    Code:
    TacPaletteColors = (pcMainColor, pcLabelText, pcWebText, pcWebTextHot, pcEditText, pcEditBG,
    pcSelectionBG, pcSelectionText, pcSelectionBG_Focused, pcSelectionText_Focused,
    pcEditBG_Inverted, pcEditText_Inverted, pcEditBG_OddRow, pcEditBG_EvenRow,
    pcEditText_Ok, pcEditText_Warning, pcEditText_Alert, pcEditText_Caution, pcEditText_Bypassed,
    pcEditBG_Ok, pcEditBG_Warning, pcEditBG_Alert, pcEditBG_Caution, pcEditBG_Bypassed,
    pcEditText_Highlight1, pcEditText_Highlight2, pcEditText_Highlight3,

    pcBtnColor1Active, pcBtnColor2Active, pcBtnBorderActive, pcBtnFontActive,
    pcBtnColor1Normal, pcBtnColor2Normal, pcBtnBorderNormal, pcBtnFontNormal,
    pcBtnColor1Pressed, pcBtnColor2Pressed, pcBtnBorderPressed, pcBtnFontPressed,

    pcBorder, pcGrid, pcHintBG, pcHintText);

    I hope it helps.

    #57057
    DrJester
    Participant
    'Support' wrote:

    Code:
    TacPaletteColors = (pcMainColor, pcLabelText, pcWebText, pcWebTextHot, pcEditText, pcEditBG,
    pcSelectionBG, pcSelectionText, pcSelectionBG_Focused, pcSelectionText_Focused,
    pcEditBG_Inverted, pcEditText_Inverted, pcEditBG_OddRow, pcEditBG_EvenRow,
    pcEditText_Ok, pcEditText_Warning, pcEditText_Alert, pcEditText_Caution, pcEditText_Bypassed,
    pcEditBG_Ok, pcEditBG_Warning, pcEditBG_Alert, pcEditBG_Caution, pcEditBG_Bypassed,
    pcEditText_Highlight1, pcEditText_Highlight2, pcEditText_Highlight3,

    pcBtnColor1Active, pcBtnColor2Active, pcBtnBorderActive, pcBtnFontActive,
    pcBtnColor1Normal, pcBtnColor2Normal, pcBtnBorderNormal, pcBtnFontNormal,
    pcBtnColor1Pressed, pcBtnColor2Pressed, pcBtnBorderPressed, pcBtnFontPressed,

    pcBorder, pcGrid, pcHintBG, pcHintText);

    I hope it helps.

    This is what I need! Thanks a lot 🙂

    #70020
    chemirikmohamed
    Participant

    Thank you very much guys, it works great, the forum and great and find our good there

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.