- This topic has 10 replies, 4 voices, and was last updated 3 years, 6 months ago by chemirikmohamed.
-
AuthorPosts
-
September 5, 2017 at 4:15 pm #37585DrJesterParticipant
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.
September 10, 2017 at 1:06 pm #57038SupportKeymasterHello!
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.
September 11, 2017 at 10:10 am #57047DrJesterParticipant'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?
September 13, 2017 at 4:10 am #57051SupportKeymasterHello!
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.September 13, 2017 at 2:11 pm #57052DrJesterParticipant'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?
September 13, 2017 at 2:57 pm #57053TAZParticipantUsing 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.
September 13, 2017 at 4:53 pm #57054DrJesterParticipant'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.
September 13, 2017 at 5:51 pm #57055TAZParticipantExperiment. 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.
September 13, 2017 at 6:17 pm #57056SupportKeymasterHello!
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.
September 14, 2017 at 7:15 am #57057DrJesterParticipant'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 🙂
May 20, 2021 at 8:03 am #70020chemirikmohamedParticipantThank you very much guys, it works great, the forum and great and find our good there
-
AuthorPosts
- You must be logged in to reply to this topic.